From b719e49da943cac32d2d31c602e8e34585df4605 Mon Sep 17 00:00:00 2001 From: David Malone Date: Sat, 30 Mar 2002 13:44:45 +0000 Subject: Minor post warns stuff. 1) Fix up vendor IDs for files I'm touching and put FBSDID in the right place. 2) Cast return value of snprintf to size_t rather than casting sizeof() to an int, 'cos we know snprintf returns a non-genative number. 3) Avoid 'char *blank = "";' by just strduping. This could be bad sometimes, but all these variables usually point at malloced memory so this makes them always point at malloced memory. --- chpass/edit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'chpass/edit.c') diff --git a/chpass/edit.c b/chpass/edit.c index e671d58..0ec0f10 100644 --- a/chpass/edit.c +++ b/chpass/edit.c @@ -31,9 +31,11 @@ * SUCH DAMAGE. */ +#if 0 #ifndef lint -static const char sccsid[] = "@(#)edit.c 8.3 (Berkeley) 4/2/94"; +static char sccsid[] = "@(#)edit.c 8.3 (Berkeley) 4/2/94"; #endif /* not lint */ +#endif #include __FBSDID("$FreeBSD$"); @@ -252,12 +254,12 @@ bad: (void)fclose(fp); while ((len = strlen(pw->pw_gecos)) && pw->pw_gecos[len - 1] == ',') pw->pw_gecos[len - 1] = '\0'; - if (snprintf(buf, sizeof(buf), + if ((size_t)snprintf(buf, sizeof(buf), "%s:%s:%lu:%lu:%s:%ld:%ld:%s:%s:%s", pw->pw_name, pw->pw_passwd, (unsigned long)pw->pw_uid, (unsigned long)pw->pw_gid, pw->pw_class, (long)pw->pw_change, (long)pw->pw_expire, pw->pw_gecos, pw->pw_dir, - pw->pw_shell) >= (int)sizeof(buf)) { + pw->pw_shell) >= sizeof(buf)) { warnx("entries too long"); free(p); return (0); -- cgit v1.2.3-56-ge451