diff options
author | brian <brian@FreeBSD.org> | 2001-08-20 23:09:33 +0800 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-08-20 23:09:33 +0800 |
commit | 5401770c3cb00061271e2c4b0d8943ad70cf9cfe (patch) | |
tree | 7479a1509725cae28d5282dd95d4b0b685feba7a | |
parent | b557c5320ee4226e301cc5265a7796360c545c4d (diff) | |
download | freebsd-ports-graphics-5401770c3cb00061271e2c4b0d8943ad70cf9cfe.tar.gz freebsd-ports-graphics-5401770c3cb00061271e2c4b0d8943ad70cf9cfe.tar.zst freebsd-ports-graphics-5401770c3cb00061271e2c4b0d8943ad70cf9cfe.zip |
Handle snprintf() returning < 0 (not just -1)
MFC after: 2 weeks
-rw-r--r-- | sysutils/diskcheckd/files/diskcheckd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sysutils/diskcheckd/files/diskcheckd.c b/sysutils/diskcheckd/files/diskcheckd.c index cb79a08944b..0b41beca526 100644 --- a/sysutils/diskcheckd/files/diskcheckd.c +++ b/sysutils/diskcheckd/files/diskcheckd.c @@ -443,7 +443,7 @@ updateproctitle(struct disk *disks) { p += sizeof _PATH_DEV - 1; percent = 100 * (double)dseek(dp, 0, SEEK_CUR) / dp->size; - if ((ret = snprintf(bp, size, "%s %.2f%%, ", p, percent)) == -1) + if ((ret = snprintf(bp, size, "%s %.2f%%, ", p, percent)) < 0) ret = 0; if ((size_t)ret >= size) { inc = ((ret + 1023) >> 10) << 10; @@ -457,7 +457,7 @@ updateproctitle(struct disk *disks) { } bp = buf + bufsize - size; ret = snprintf(bp, size, "%s %.2f%%, ", p, percent); - if (ret == -1) + if (ret < 0) ret = 0; } bp += ret; |