Checking errno otherwise is unspecified.
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;