int opt, flags;
struct param_t param;
- /* Just -1 might not work: uid_t may be unsigned long */
- param.ugid.uid = -1L;
- param.ugid.gid = -1L;
-
#if ENABLE_FEATURE_CHOWN_LONG_OPTIONS
applet_long_options = chown_longopts;
#endif
write_pidfile(pidfile);
}
if (opt & OPT_c) {
- struct bb_uidgid_t ugid = { -1, -1 };
+ struct bb_uidgid_t ugid;
parse_chown_usergroup_or_die(&ugid, chuid);
- if (ugid.uid != (uid_t) -1) {
+ if (ugid.uid != (uid_t) -1L) {
struct passwd *pw = xgetpwuid(ugid.uid);
- if (ugid.gid != (gid_t) -1)
+ if (ugid.gid != (gid_t) -1L)
pw->pw_gid = ugid.gid;
/* initgroups, setgid, setuid: */
change_identity(pw);
- } else if (ugid.gid != (gid_t) -1) {
+ } else if (ugid.gid != (gid_t) -1L) {
xsetgid(ugid.gid);
setgroups(1, &ugid.gid);
}
{
char *group;
+ u->uid = u->gid = (gid_t)-1L;
+
/* Check if there is a group name */
group = strchr(user_group, '.'); /* deprecated? */
if (!group)