logo

skeud

Simple and portable utilities to deal with user accounts (su, login)
commit: 0c3146587c85c853d8f987051d92d3b5f5de1363
parent c4ec30e346e9db12167b9d34a4a3441376c64252
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue,  1 Nov 2022 18:06:53 +0100

login: Always prefix error messages

Diffstat:

Mlogin.c10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/login.c b/login.c @@ -96,7 +96,7 @@ main(int argc, char *argv[]) ssize_t got = getline(&username, &len, stdin); if(got < 0) { - if(errno != 0) perror("getline"); + if(errno != 0) perror("login: getline"); return 1; } @@ -110,7 +110,7 @@ main(int argc, char *argv[]) pwent = getpwnam(username); if(errno != 0) { - perror("getpwnam"); + perror("login: getpwnam"); } if(!opt_f) @@ -169,11 +169,11 @@ main(int argc, char *argv[]) { if(setgid(pwent->pw_gid) < 0) { - perror("setgid"); + perror("login: setgid"); } if(setuid(pwent->pw_uid) < 0) { - perror("setuid"); + perror("login: setuid"); } if(pwent->pw_shell != NULL) @@ -187,7 +187,7 @@ main(int argc, char *argv[]) if(chdir(pwent->pw_dir) != 0) { - perror("chdir"); + perror("login: chdir"); } }