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 | d7463a76c3906be230e29406027fcbc5a22e82da (patch) | |
tree | d8ac11a3b95b1443eb931a086b4fb3b19e03b161 /pw/pw_conf.c | |
parent | 4b3445eae2d7564a4289afb2255dd4c60777519b (diff) | |
download | pw-darwin-d7463a76c3906be230e29406027fcbc5a22e82da.tar.gz pw-darwin-d7463a76c3906be230e29406027fcbc5a22e82da.tar.zst pw-darwin-d7463a76c3906be230e29406027fcbc5a22e82da.zip |
Handle snprintf() returning < 0 (not just -1)
MFC after: 2 weeks
Diffstat (limited to 'pw/pw_conf.c')
-rw-r--r-- | pw/pw_conf.c | 4 |
1 files changed, 2 insertions, 2 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); |