Introduction
Introduction Statistics Contact Development Disclaimer Help
Only check errno if getpwuid() fails - slock - simple X display locker utility
git clone git://git.suckless.org/slock
Log
Files
Refs
README
LICENSE
---
commit 8745098fa440ef3bf1d8e173dcd91514b34600c6
parent 9db14b10dd09336c6a8fe283f99108c9acc4667a
Author: sin <[email protected]>
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 …
+ if (!pw) {
+ if (errno)
+ die("slock: getpwuid: %s\n", strerror(errno));
+ else
+ die("slock: cannot retrieve password entry (make sure …
+ }
endpwent();
rval = pw->pw_passwd;
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.