From: Yehuda Sadeh Date: Mon, 4 Jun 2012 23:01:07 +0000 (-0700) Subject: rgw: try to create fcgi socket through open() first X-Git-Tag: v0.48argonaut~135 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5087997a1c90ecd1244dc1047a17858607c940f9;p=ceph.git rgw: try to create fcgi socket through open() first FCGX_OpenSocket might just exit() without any warning if it fails to create the socket. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index c742c1ebd3166..7738d4c4f536b 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -193,6 +193,16 @@ void RGWProcess::run() int s = 0; if (!g_conf->rgw_socket_path.empty()) { string path_str = g_conf->rgw_socket_path; + + /* this is necessary, as FCGX_OpenSocket might not return an error, but rather ungracefully exit */ + int fd = open(path_str.c_str(), O_CREAT, 0644); + if (fd < 0) { + int err = errno; + dout(0) << "ERROR: cannot create socket: path=" << path_str << " error=" << cpp_strerror(err) << dendl; + return; + } + close(fd); + const char *path = path_str.c_str(); s = FCGX_OpenSocket(path, SOCKET_BACKLOG); if (s < 0) {