diff options
author | Brian Somers <brian@FreeBSD.org> | 2001-08-20 13:24:38 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2001-08-20 13:24:38 +0000 |
commit | d390477901e8215153898980bd330620edd48ea5 (patch) | |
tree | 959ee35afc38e22774c28c8ddb62c577a44899cf /sysutils/diskcheckd | |
parent | Chase checksum; trivial pixmap change. (diff) |
Handle snprintf() returning -1.
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=46537
Diffstat (limited to 'sysutils/diskcheckd')
-rw-r--r-- | sysutils/diskcheckd/files/diskcheckd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sysutils/diskcheckd/files/diskcheckd.c b/sysutils/diskcheckd/files/diskcheckd.c index 558b583f6c39..cb79a08944ba 100644 --- a/sysutils/diskcheckd/files/diskcheckd.c +++ b/sysutils/diskcheckd/files/diskcheckd.c @@ -443,8 +443,9 @@ updateproctitle(struct disk *disks) { p += sizeof _PATH_DEV - 1; percent = 100 * (double)dseek(dp, 0, SEEK_CUR) / dp->size; - if ((size_t)(ret = snprintf(bp, size, - "%s %.2f%%, ", p, percent)) >= size) { + if ((ret = snprintf(bp, size, "%s %.2f%%, ", p, percent)) == -1) + ret = 0; + if ((size_t)ret >= size) { inc = ((ret + 1023) >> 10) << 10; size += inc; bufsize += inc; @@ -456,6 +457,8 @@ updateproctitle(struct disk *disks) { } bp = buf + bufsize - size; ret = snprintf(bp, size, "%s %.2f%%, ", p, percent); + if (ret == -1) + ret = 0; } bp += ret; size -= ret; |