diff options
author | Wayne Davison <wayned@samba.org> | 2008-11-09 18:46:55 -0800 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2008-11-09 18:56:21 -0800 |
commit | 9411292489496984c8d5d9a446bf071afac3866d (patch) | |
tree | a68d29f7e1387a01ecbd0daaff821b3fe3d3b799 /lib/pool_alloc.c | |
parent | b4de848d75b5bc289f13c4f47a4f78d4c876b1a2 (diff) | |
download | rsync-9411292489496984c8d5d9a446bf071afac3866d.tar.gz |
Fixed a bunch of "warn_unused_result" compiler warnings.
Diffstat (limited to 'lib/pool_alloc.c')
-rw-r--r-- | lib/pool_alloc.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/lib/pool_alloc.c b/lib/pool_alloc.c index 4c76d356..5856d591 100644 --- a/lib/pool_alloc.c +++ b/lib/pool_alloc.c @@ -326,24 +326,30 @@ pool_boundary(alloc_pool_t p, size_t len) } #define FDPRINT(label, value) \ - snprintf(buf, sizeof buf, label, value), \ - write(fd, buf, strlen(buf)) + do { \ + int len = snprintf(buf, sizeof buf, label, value); \ + if (write(fd, buf, len) != len) \ + ret = -1; \ + } while (0) #define FDEXTSTAT(ext) \ - snprintf(buf, sizeof buf, " %12ld %5ld\n", \ - (long) ext->free, \ - (long) ext->bound), \ - write(fd, buf, strlen(buf)) - -void + do { \ + int len = snprintf(buf, sizeof buf, " %12ld %5ld\n", \ + (long)ext->free, (long)ext->bound); \ + if (write(fd, buf, len) != len) \ + ret = -1; \ + } while (0) + +int pool_stats(alloc_pool_t p, int fd, int summarize) { struct alloc_pool *pool = (struct alloc_pool *) p; struct pool_extent *cur; char buf[BUFSIZ]; + int ret = 0; if (!pool) - return; + return ret; FDPRINT(" Extent size: %12ld\n", (long) pool->size); FDPRINT(" Alloc quantum: %12ld\n", (long) pool->quantum); @@ -355,13 +361,16 @@ pool_stats(alloc_pool_t p, int fd, int summarize) FDPRINT(" Bytes freed: %12.0f\n", (double) pool->b_freed); if (summarize) - return; + return ret; if (!pool->extents) - return; + return ret; - write(fd, "\n", 1); + if (write(fd, "\n", 1) != 1) + ret = -1; for (cur = pool->extents; cur; cur = cur->next) FDEXTSTAT(cur); + + return ret; } |