summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-08-20 15:09:34 +0000
committerbrian <brian@FreeBSD.org>2001-08-20 15:09:34 +0000
commit9e766e7f13d026d09ebeb4382645602066d515f1 (patch)
treee4cd080245144f4b39a65872690adec1ed0c8bda /usr.sbin/pw
parent894d298c86524f82e074b5df0bb25939bc20c3ec (diff)
downloadFreeBSD-src-9e766e7f13d026d09ebeb4382645602066d515f1.zip
FreeBSD-src-9e766e7f13d026d09ebeb4382645602066d515f1.tar.gz
Handle snprintf() returning < 0 (not just -1)
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r--usr.sbin/pw/pw_conf.c4
-rw-r--r--usr.sbin/pw/pwupd.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/pw/pw_conf.c b/usr.sbin/pw/pw_conf.c
index e4c5a4a..9377239 100644
--- a/usr.sbin/pw/pw_conf.c
+++ b/usr.sbin/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);
diff --git a/usr.sbin/pw/pwupd.c b/usr.sbin/pw/pwupd.c
index ec29b9e..67a816f 100644
--- a/usr.sbin/pw/pwupd.c
+++ b/usr.sbin/pw/pwupd.c
@@ -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) {
OpenPOWER on IntegriCloud