diff options
author | Brian Somers <brian@FreeBSD.org> | 2001-08-20 15:09:34 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2001-08-20 15:09:34 +0000 |
commit | 6960cf009310003dfc79d5a3f9bf9d3db2105a7f (patch) | |
tree | 3040d8bb42f40533d1ba37d1f5cd374d077d83ae /pw | |
parent | fee8e0724b96f65b1c5b143b33b4a00b4b3c92f7 (diff) | |
download | pw-darwin-6960cf009310003dfc79d5a3f9bf9d3db2105a7f.tar.gz pw-darwin-6960cf009310003dfc79d5a3f9bf9d3db2105a7f.tar.zst pw-darwin-6960cf009310003dfc79d5a3f9bf9d3db2105a7f.zip |
Handle snprintf() returning < 0 (not just -1)
MFC after: 2 weeks
Diffstat (limited to 'pw')
-rw-r--r-- | pw/pw_conf.c | 4 | ||||
-rw-r--r-- | pw/pwupd.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/pw/pw_conf.c b/pw/pw_conf.c index e4c5a4a..9377239 100644 --- a/pw/pw_conf.c +++ b/pw/pw_conf.c @@ -420,7 +420,7 @@ write_userconfig(char const * file) for (j = k = 0; j < _UC_MAXSHELLS && system_shells[j] != NULL; j++) { char lbuf[64]; int l = snprintf(lbuf, sizeof lbuf, "%s\"%s\"", k ? "," : "", system_shells[j]); - if (l == -1) + if (l < 0) l = 0; if (l + k + 1 < len || extendline(&buf, &len, len + LNBUFSZ) != -1) { strcpy(buf + k, lbuf); @@ -440,7 +440,7 @@ write_userconfig(char const * file) for (j = k = 0; j < config.numgroups && config.groups[j] != NULL; j++) { char lbuf[64]; int l = snprintf(lbuf, sizeof lbuf, "%s\"%s\"", k ? "," : "", config.groups[j]); - if (l == -1) + if (l < 0) l = 0; if (l + k + 1 < len || extendline(&buf, &len, len + 1024) != -1) { strcpy(buf + k, lbuf); @@ -166,7 +166,7 @@ pw_update(struct passwd * pwd, char const * user, int mode) else fmtpwentry(pwbuf, pwd, PWF_PASSWD); - if (l == -1) + if (l < 0) l = 0; rc = fileupdate(getpwpath(_PASSWD), 0644, pwbuf, pfx, l, mode); if (rc == 0) { |