]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix partial read mime map issue 6761/head
authorJiaying Ren <mikulely@gmail.com>
Wed, 2 Dec 2015 07:52:12 +0000 (15:52 +0800)
committerJiaying Ren <mikulely@gmail.com>
Wed, 2 Dec 2015 07:52:12 +0000 (15:52 +0800)
Signed-off-by: Jiaying Ren <mikulely@gmail.com>
src/rgw/rgw_tools.cc

index 6f198c9a8a8f03964c41f7b3027039df22103ca7..0dfc3e6ec4e035ee6154d578bcf5400589207694 100644 (file)
@@ -4,6 +4,7 @@
 #include <errno.h>
 
 #include "common/errno.h"
+#include "common/safe_io.h"
 
 #include "include/types.h"
 
@@ -141,9 +142,9 @@ static int ext_mime_map_init(CephContext *cct, const char *ext_map)
     goto done;
   }
 
-  ret = read(fd, buf, st.st_size + 1);
+  ret = safe_read(fd, buf, st.st_size + 1);
   if (ret != st.st_size) {
-    // huh? file size has changed, what are the odds?
+    // huh? file size has changed?
     ldout(cct, 0) << "ext_mime_map_init(): raced! will retry.." << dendl;
     free(buf);
     close(fd);