diff options
-rw-r--r-- | coreutils/chown.c | 4 | ||||
-rw-r--r-- | debianutils/start_stop_daemon.c | 8 | ||||
-rw-r--r-- | libpwdgrp/uidgid_get.c | 2 |
3 files changed, 6 insertions, 8 deletions
diff --git a/coreutils/chown.c b/coreutils/chown.c index eaa1ee2a3..247aa3bf1 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c | |||
@@ -112,10 +112,6 @@ int chown_main(int argc UNUSED_PARAM, char **argv) | |||
112 | int opt, flags; | 112 | int opt, flags; |
113 | struct param_t param; | 113 | struct param_t param; |
114 | 114 | ||
115 | /* Just -1 might not work: uid_t may be unsigned long */ | ||
116 | param.ugid.uid = -1L; | ||
117 | param.ugid.gid = -1L; | ||
118 | |||
119 | #if ENABLE_FEATURE_CHOWN_LONG_OPTIONS | 115 | #if ENABLE_FEATURE_CHOWN_LONG_OPTIONS |
120 | applet_long_options = chown_longopts; | 116 | applet_long_options = chown_longopts; |
121 | #endif | 117 | #endif |
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 42f1943dd..d7c730f45 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c | |||
@@ -539,15 +539,15 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv) | |||
539 | write_pidfile(pidfile); | 539 | write_pidfile(pidfile); |
540 | } | 540 | } |
541 | if (opt & OPT_c) { | 541 | if (opt & OPT_c) { |
542 | struct bb_uidgid_t ugid = { -1, -1 }; | 542 | struct bb_uidgid_t ugid; |
543 | parse_chown_usergroup_or_die(&ugid, chuid); | 543 | parse_chown_usergroup_or_die(&ugid, chuid); |
544 | if (ugid.uid != (uid_t) -1) { | 544 | if (ugid.uid != (uid_t) -1L) { |
545 | struct passwd *pw = xgetpwuid(ugid.uid); | 545 | struct passwd *pw = xgetpwuid(ugid.uid); |
546 | if (ugid.gid != (gid_t) -1) | 546 | if (ugid.gid != (gid_t) -1L) |
547 | pw->pw_gid = ugid.gid; | 547 | pw->pw_gid = ugid.gid; |
548 | /* initgroups, setgid, setuid: */ | 548 | /* initgroups, setgid, setuid: */ |
549 | change_identity(pw); | 549 | change_identity(pw); |
550 | } else if (ugid.gid != (gid_t) -1) { | 550 | } else if (ugid.gid != (gid_t) -1L) { |
551 | xsetgid(ugid.gid); | 551 | xsetgid(ugid.gid); |
552 | setgroups(1, &ugid.gid); | 552 | setgroups(1, &ugid.gid); |
553 | } | 553 | } |
diff --git a/libpwdgrp/uidgid_get.c b/libpwdgrp/uidgid_get.c index eeb65191f..1199f23f9 100644 --- a/libpwdgrp/uidgid_get.c +++ b/libpwdgrp/uidgid_get.c | |||
@@ -90,6 +90,8 @@ void FAST_FUNC parse_chown_usergroup_or_die(struct bb_uidgid_t *u, char *user_gr | |||
90 | { | 90 | { |
91 | char *group; | 91 | char *group; |
92 | 92 | ||
93 | u->uid = u->gid = (gid_t)-1L; | ||
94 | |||
93 | /* Check if there is a group name */ | 95 | /* Check if there is a group name */ |
94 | group = strchr(user_group, '.'); /* deprecated? */ | 96 | group = strchr(user_group, '.'); /* deprecated? */ |
95 | if (!group) | 97 | if (!group) |