diff options
author | Guillem Jover <guillem@debian.org> | 2009-01-10 21:38:38 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2009-01-10 21:45:23 +0200 |
commit | 5ea9550838a25852086e20cffa6c74ed3ccc7375 (patch) | |
tree | 814b63ab99f888535577366965a80d82f0cdb6fb /utils | |
parent | c5dbb9bf21a0ff70c0b350e66fef70cab88bfb7d (diff) | |
download | dpkg-5ea9550838a25852086e20cffa6c74ed3ccc7375.tar.gz |
s-s-d: Behave the same way whether --chuid gets a user name or a uid
Otherwise it was failing to setup the default group for the user if it
had not been specified and the HOME environment variable.
Closes: #368000
Diffstat (limited to 'utils')
-rw-r--r-- | utils/start-stop-daemon.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c index 5a5c92125..40366c6de 100644 --- a/utils/start-stop-daemon.c +++ b/utils/start-stop-daemon.c @@ -1267,8 +1267,13 @@ main(int argc, char **argv) fatal("group `%s' not found\n", changegroup); runas_gid = gr->gr_gid; } - if (changeuser && sscanf(changeuser, "%d", &runas_uid) != 1) { - struct passwd *pw = getpwnam(changeuser); + if (changeuser) { + struct passwd *pw; + + if (sscanf(changeuser, "%d", &runas_uid) == 1) + pw = getpwuid(runas_uid); + else + pw = getpwnam(changeuser); if (!pw) fatal("user `%s' not found\n", changeuser); runas_uid = pw->pw_uid; |