aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-09-08 23:17:24 -0500
committerRob Landley <rob@landley.net>2015-09-08 23:19:40 -0500
commitd067571abb2b7934f3350c90ca891beb987c68fd (patch)
treeacea94d7a1be3be698a882b25e109705df95d742 /toys/pending
parenta35650c83eaff85714f6483cccb7dd9c8c5bb3e8 (diff)
downloadtoybox-d067571abb2b7934f3350c90ca891beb987c68fd.tar.gz
Squish more warnings in pending.
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/useradd.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/toys/pending/useradd.c b/toys/pending/useradd.c
index 78f083b7..4d4c671e 100644
--- a/toys/pending/useradd.c
+++ b/toys/pending/useradd.c
@@ -105,10 +105,10 @@ void useradd_main(void)
// Create a new group for user
if (!(toys.optflags & FLAG_G)) {
- char *s = xmprintf("-g%ld", pwd.pw_gid);
+ char *s = xmprintf("-g%ld", (long)pwd.pw_gid);
if (xrun((char *[]){"groupadd", *toys.optargs, s, 0}))
- error_msg("addgroup -g%ld fail", pwd.pw_gid);
+ error_msg("addgroup -g%ld fail", (long)pwd.pw_gid);
free(s);
}
@@ -120,15 +120,16 @@ void useradd_main(void)
// 1. add an entry to /etc/passwd and /etc/shadow file
entry = xmprintf("%s:%s:%ld:%ld:%s:%s:%s", pwd.pw_name, pwd.pw_passwd,
- pwd.pw_uid, pwd.pw_gid, pwd.pw_gecos, pwd.pw_dir, pwd.pw_shell);
+ (long)pwd.pw_uid, (long)pwd.pw_gid, pwd.pw_gecos, pwd.pw_dir,
+ pwd.pw_shell);
if (update_password("/etc/passwd", pwd.pw_name, entry)) error_exit("updating passwd file failed");
free(entry);
if (toys.optflags & FLAG_S)
entry = xmprintf("%s:!!:%u::::::", pwd.pw_name,
(unsigned)(time(NULL))/(24*60*60)); //passwd is not set initially
- else entry = xmprintf("%s:!!:%u:%ld:%ld:%ld:::", pwd.pw_name,
- (unsigned)(time(NULL))/(24*60*60), 0, 99999, 7); //passwd is not set initially
+ else entry = xmprintf("%s:!!:%u:0:99999:7:::", pwd.pw_name,
+ (unsigned)(time(0))/(24*60*60)); //passwd is not set initially
update_password("/etc/shadow", pwd.pw_name, entry);
free(entry);
@@ -143,7 +144,7 @@ void useradd_main(void)
else toys.exitval = xrun((char *[]){"mkdir", "-p", p, 0});
if (!toys.exitval)
toys.exitval |= xrun((char *[]){"chown", "-R",
- xmprintf("%u:%u", TT.uid, TT.gid), p, 0});
+ xmprintf("%lu:%lu", TT.uid, TT.gid), p, 0});
wfchmodat(AT_FDCWD, p, 0700);
} else fprintf(stderr, "'%s' exists, not copying '%s'", p, skel);
}