diff options
author | David Nugent <davidn@FreeBSD.org> | 1997-01-07 13:29:21 +0000 |
---|---|---|
committer | David Nugent <davidn@FreeBSD.org> | 1997-01-07 13:29:21 +0000 |
commit | ff78d6cea19ba392d6c389ad3a16f10e3f245fb5 (patch) | |
tree | d8b25dc6569ce3145d1948bb8e840baf4b8b4922 | |
parent | 3f5e90cd330e96e54e53d75397bb6bef56153218 (diff) | |
download | pw-darwin-ff78d6cea19ba392d6c389ad3a16f10e3f245fb5.tar.gz pw-darwin-ff78d6cea19ba392d6c389ad3a16f10e3f245fb5.tar.zst pw-darwin-ff78d6cea19ba392d6c389ad3a16f10e3f245fb5.zip |
Fix for login_getclass(NULL) case.
-rw-r--r-- | libutil/login_cap.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libutil/login_cap.c b/libutil/login_cap.c index 21ff02f..8f3c56d 100644 --- a/libutil/login_cap.c +++ b/libutil/login_cap.c @@ -21,7 +21,7 @@ * * Low-level routines relating to the user capabilities database * - * $Id$ + * $Id: login_cap.c,v 1.1 1997/01/04 16:50:02 davidn Exp $ */ #include <stdio.h> @@ -214,9 +214,11 @@ login_getclassbyname(char const * name, char const * dir) login_cap_t * login_getclass(const struct passwd *pwd) { - const char * class = (pwd == NULL) ? NULL : pwd->pw_class; - if (pwd->pw_class == NULL || *pwd->pw_class == '\0') - class = (pwd->pw_uid == 0) ? "root" : NULL; /* Kludge for 'root' user(s) */ + const char * class = NULL; + if (pwd == NULL) { + if ((class = pwd->pw_class) == NULL) || *class == '\0') + class = (pwd->pw_uid == 0) ? "root" : NULL; + } return login_getclassbyname(class, 0); } |