diff options
-rw-r--r-- | miscutils/devfsd.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 24c953bac..96ffe0738 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
@@ -1083,21 +1083,23 @@ static int get_uid_gid(int flag, const char *string) | |||
1083 | { | 1083 | { |
1084 | struct passwd *pw_ent; | 1084 | struct passwd *pw_ent; |
1085 | struct group *grp_ent; | 1085 | struct group *grp_ent; |
1086 | static const char *msg; | 1086 | const char *msg; |
1087 | 1087 | ||
1088 | if (ENABLE_DEVFSD_VERBOSE) | 1088 | if (isdigit(string[0]) || ((string[0] == '-') && isdigit(string[1]))) |
1089 | msg = "user"; | ||
1090 | |||
1091 | if (isdigit(string[0]) ||((string[0] == '-') && isdigit(string[1]))) | ||
1092 | return atoi(string); | 1089 | return atoi(string); |
1093 | 1090 | ||
1094 | if (flag == UID && (pw_ent = getpwnam(string)) != NULL) | 1091 | if (flag == UID && (pw_ent = getpwnam(string)) != NULL) |
1095 | return pw_ent->pw_uid; | 1092 | return pw_ent->pw_uid; |
1096 | 1093 | ||
1097 | if (flag == GID && (grp_ent = getgrnam(string)) != NULL) | 1094 | if (ENABLE_DEVFSD_VERBOSE) |
1098 | return grp_ent->gr_gid; | 1095 | msg = "user"; |
1099 | else if (ENABLE_DEVFSD_VERBOSE) | 1096 | |
1100 | msg = "group"; | 1097 | if (flag == GID) { |
1098 | if ((grp_ent = getgrnam(string)) != NULL) | ||
1099 | return grp_ent->gr_gid; | ||
1100 | if (ENABLE_DEVFSD_VERBOSE) | ||
1101 | msg = "group"; | ||
1102 | } | ||
1101 | 1103 | ||
1102 | if (ENABLE_DEVFSD_VERBOSE) | 1104 | if (ENABLE_DEVFSD_VERBOSE) |
1103 | msg_logger(LOG_ERR, "unknown %s: %s, defaulting to %cid=0", msg, string, msg[0]); | 1105 | msg_logger(LOG_ERR, "unknown %s: %s, defaulting to %cid=0", msg, string, msg[0]); |