]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
confutils: check return values
authorSage Weil <sage.weil@dreamhost.com>
Wed, 2 Feb 2011 05:07:45 +0000 (21:07 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 2 Feb 2011 15:50:57 +0000 (07:50 -0800)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/common/ConfUtils.cc

index 295651ef1744b7dbaec198419bac8b150785812e..77c5796b7615b0eae8b1dc929c3da52b48ce114c 100644 (file)
@@ -540,11 +540,12 @@ int ConfLine::output(char *line, int max_len)
 void ConfFile::_dump(int fd)
 {
        SectionList::iterator sec_iter, sec_end;
-        ConfLine *cl;
+       ConfLine *cl;
        char *line;
        size_t max_line = MAX_LINE;
        size_t len;
        char *p;
+       int r;
 
        line = (char *)malloc(max_line);
 
@@ -573,8 +574,12 @@ void ConfFile::_dump(int fd)
 
                                        len = cl->output(line, max_line);
                                } while (len == max_line);
-                               ::write(fd, line, strlen(line));
-                               ::write(fd, "\n", 1);
+                               r = ::write(fd, line, strlen(line));
+                               if (r < 0)
+                                       return;
+                               r = ::write(fd, "\n", 1);
+                               if (r < 0)
+                                       return;
                        }
                }
        }