about summary refs log tree commit homepage
path: root/dev.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-12-03 23:19:55 +0000
committerEric Wong <normalperson@yhbt.net>2012-12-03 23:19:55 +0000
commit05550b1ac2fb18090586d104c50b90819a5da015 (patch)
treec910ad29c47aee34269d1ad387d5fa3bdbaed9d7 /dev.c
parent441ffb68a7d89556da0efe8fdf64538acc5eeb87 (diff)
downloadcmogstored-05550b1ac2fb18090586d104c50b90819a5da015.tar.gz
dprintf() may return a non-negative value and still set ENOSPC
on partially-written data.
Diffstat (limited to 'dev.c')
-rw-r--r--dev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dev.c b/dev.c
index 9c2f0f8..9d5ccc7 100644
--- a/dev.c
+++ b/dev.c
@@ -49,6 +49,8 @@ const struct mog_dev *dev, struct mog_svc *svc, int fd, struct statvfs *v)
                         "total: %llu\n"
                         "use: %u%%\n"
                         "used: %llu\n";
+
+                errno = 0;
                 rc = dprintf(fd, usage_fmt,
                              available * (v->f_frsize / 1024),
                              me->me_devname,
@@ -59,7 +61,7 @@ const struct mog_dev *dev, struct mog_svc *svc, int fd, struct statvfs *v)
                              used * (v->f_frsize / 1024));
 
                 PRESERVE_ERRNO( mog_mnt_release(me) );
-                if (rc < 0) {
+                if (rc < 0 || errno == ENOSPC) {
                         PRESERVE_ERRNO(do {
                                 syslog(LOG_ERR, "dprintf(%s%s/usage): %m",
                                        svc->docroot, dev->prefix);