summaryrefslogtreecommitdiffstats
path: root/chpass/edit.c
diff options
context:
space:
mode:
authorDavid Malone <dwmalone@FreeBSD.org>2002-03-30 13:44:45 +0000
committerDavid Malone <dwmalone@FreeBSD.org>2002-03-30 13:44:45 +0000
commitb719e49da943cac32d2d31c602e8e34585df4605 (patch)
tree51aa80b2fbdafa59664605b1d37b10b3941bcc2a /chpass/edit.c
parent04d1b23be991cae809ac39645d9ac7341ec74885 (diff)
downloadpw-darwin-b719e49da943cac32d2d31c602e8e34585df4605.tar.gz
pw-darwin-b719e49da943cac32d2d31c602e8e34585df4605.tar.zst
pw-darwin-b719e49da943cac32d2d31c602e8e34585df4605.zip
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.
Diffstat (limited to 'chpass/edit.c')
-rw-r--r--chpass/edit.c8
1 files changed, 5 insertions, 3 deletions
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 <sys/cdefs.h>
__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);