diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rc/start-stop-daemon.c | 5 | ||||
-rw-r--r-- | src/rc/supervise-daemon.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index aafada88..99e5b6a0 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -389,10 +389,11 @@ int main(int argc, char **argv) /* falls through */ case 'u': /* --user <username>|<uid> */ { + char dummy[2]; p = optarg; tmp = strsep(&p, ":"); changeuser = xstrdup(tmp); - if (sscanf(tmp, "%d", &tid) != 1) + if (sscanf(tmp, "%d%1s", &tid, dummy) != 1) pw = getpwnam(tmp); else pw = getpwuid((uid_t)tid); @@ -413,7 +414,7 @@ int main(int argc, char **argv) if (p) { tmp = strsep (&p, ":"); - if (sscanf(tmp, "%d", &tid) != 1) + if (sscanf(tmp, "%d%1s", &tid, dummy) != 1) gr = getgrnam(tmp); else gr = getgrgid((gid_t) tid); diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c index b3d63589..ea9e5333 100644 --- a/src/rc/supervise-daemon.c +++ b/src/rc/supervise-daemon.c @@ -855,10 +855,11 @@ int main(int argc, char **argv) case 'u': /* --user <username>|<uid> */ { + char dummy[2]; p = optarg; tmp = strsep(&p, ":"); changeuser = xstrdup(tmp); - if (sscanf(tmp, "%d", &tid) != 1) + if (sscanf(tmp, "%d%1s", &tid, dummy) != 1) pw = getpwnam(tmp); else pw = getpwuid((uid_t)tid); @@ -879,7 +880,7 @@ int main(int argc, char **argv) if (p) { tmp = strsep (&p, ":"); - if (sscanf(tmp, "%d", &tid) != 1) + if (sscanf(tmp, "%d%1s", &tid, dummy) != 1) gr = getgrnam(tmp); else gr = getgrgid((gid_t) tid); |