aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/slock.c b/slock.c
index 467937c..506231e 100644
--- a/slock.c
+++ b/slock.c
@@ -65,8 +65,11 @@ getpw(void) { /* only run as root */
65 const char *rval; 65 const char *rval;
66 struct passwd *pw; 66 struct passwd *pw;
67 67
68 errno = 0;
68 pw = getpwuid(getuid()); 69 pw = getpwuid(getuid());
69 if(!pw) 70 if (errno)
71 die("slock: getpwuid: %s\n", strerror(errno));
72 else if (!pw)
70 die("slock: cannot retrieve password entry (make sure to suid or sgid slock)\n"); 73 die("slock: cannot retrieve password entry (make sure to suid or sgid slock)\n");
71 endpwent(); 74 endpwent();
72 rval = pw->pw_passwd; 75 rval = pw->pw_passwd;