From: Jiaying Ren Date: Wed, 2 Dec 2015 07:52:12 +0000 (+0800) Subject: rgw: fix partial read mime map issue X-Git-Tag: v10.0.1~8^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c4fbec7118182f945b25ef2e11cf566aa359be1d;p=ceph.git rgw: fix partial read mime map issue Signed-off-by: Jiaying Ren --- diff --git a/src/rgw/rgw_tools.cc b/src/rgw/rgw_tools.cc index 6f198c9a8a8f..0dfc3e6ec4e0 100644 --- a/src/rgw/rgw_tools.cc +++ b/src/rgw/rgw_tools.cc @@ -4,6 +4,7 @@ #include #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);