summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-08-17 06:54:22 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-08-17 06:54:22 +0000
commitc965f09e65fa7c325969098664cf6480bedb13ae (patch)
tree0a6762969c5d0b7e204add160991acb649fdd86e /lib
parent8fa6444b69ff993eb195224a8967d9297a9fc138 (diff)
Use %lld and cast to (long long) when printing time_t values and atoll()
when parsing them. Add a couple [ug]id_t --> u_int casts for consistency with rest of code. Based on a diff from Nathanael Rensen (nathanael (at) polymorpheus.com)
Diffstat (limited to 'lib')
-rw-r--r--lib/libutil/passwd.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c
index 774dff86e77..26db941e83c 100644
--- a/lib/libutil/passwd.c
+++ b/lib/libutil/passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: passwd.c,v 1.51 2013/08/06 22:47:43 millert Exp $ */
+/* $OpenBSD: passwd.c,v 1.52 2013/08/17 06:54:21 guenther Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -347,19 +347,20 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, const struct passwd *opw)
pw_error(NULL, 0, 1);
}
}
- (void)fprintf(to, "%s:%s:%u:%u:%s:%d:%d:%s:%s:%s\n",
+ (void)fprintf(to, "%s:%s:%u:%u:%s:%lld:%lld:%s:%s:%s\n",
pw->pw_name, pw->pw_passwd, (u_int)pw->pw_uid,
- (u_int)pw->pw_gid, pw->pw_class, pw->pw_change,
- pw->pw_expire, pw->pw_gecos, pw->pw_dir,
+ (u_int)pw->pw_gid, pw->pw_class, (long long)pw->pw_change,
+ (long long)pw->pw_expire, pw->pw_gecos, pw->pw_dir,
pw->pw_shell);
done = 1;
if (ferror(to))
goto fail;
}
if (!done)
- (void)fprintf(to, "%s:%s:%u:%u:%s:%d:%d:%s:%s:%s\n",
- pw->pw_name, pw->pw_passwd, pw->pw_uid, pw->pw_gid,
- pw->pw_class, pw->pw_change, pw->pw_expire, pw->pw_gecos,
+ (void)fprintf(to, "%s:%s:%u:%u:%s:%lld:%lld:%s:%s:%s\n",
+ pw->pw_name, pw->pw_passwd, (u_int)pw->pw_uid,
+ (u_int)pw->pw_gid, pw->pw_class, (long long)pw->pw_change,
+ (long long)pw->pw_expire, pw->pw_gecos,
pw->pw_dir, pw->pw_shell);
if (ferror(to))
@@ -426,12 +427,12 @@ pw_scan(char *bp, struct passwd *pw, int *flags)
pw->pw_class = strsep(&bp, ":"); /* class */
if (!(p = strsep(&bp, ":"))) /* change */
goto fmt;
- pw->pw_change = atol(p);
+ pw->pw_change = atoll(p);
if ((*p == '\0') && (flags != (int *)NULL))
*flags |= _PASSWORD_NOCHG;
if (!(p = strsep(&bp, ":"))) /* expire */
goto fmt;
- pw->pw_expire = atol(p);
+ pw->pw_expire = atoll(p);
if ((*p == '\0') && (flags != (int *)NULL))
*flags |= _PASSWORD_NOEXP;
pw->pw_gecos = strsep(&bp, ":"); /* gecos */