slock
simple X display locker utility
git clone https://9o.is/git/slock.git
commit 2c492d4623819cedd1347ca762f299db5e940cfa parent 163cf4eecb0a746d6c080e57fec4035eb6e7f9eb Author: sin <sin@2f30.org> Date: Wed, 9 Jul 2014 14:40:49 +0100 Only check errno if getpwuid() fails Checking errno otherwise is unspecified. Diffstat:
| M | slock.c | | | 10 | ++++++---- |
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/slock.c b/slock.c @@ -67,10 +67,12 @@ getpw(void) { /* only run as root */ errno = 0; pw = getpwuid(getuid()); - if (errno) - die("slock: getpwuid: %s\n", strerror(errno)); - else if (!pw) - die("slock: cannot retrieve password entry (make sure to suid or sgid slock)\n"); + if (!pw) { + if (errno) + die("slock: getpwuid: %s\n", strerror(errno)); + else + die("slock: cannot retrieve password entry (make sure to suid or sgid slock)\n"); + } endpwent(); rval = pw->pw_passwd;