summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2012-06-20 10:49:16 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2012-08-23 14:38:48 +0200
commitc6f680ee4945f22670d133ba341bb670c1d0a474 (patch)
tree392d060703816dbe0817f97bdec74beb68fd3a92
parent5d0e7fb4edbe2c4e999eaa6210b6c9e25bdd5e91 (diff)
downloadlvm2-c6f680ee4945f22670d133ba341bb670c1d0a474.zip
lvm2-c6f680ee4945f22670d133ba341bb670c1d0a474.tar.gz
lvm2-c6f680ee4945f22670d133ba341bb670c1d0a474.tar.xz
clvmd,lvmetad: check for fcntl result
Report any problem of fcntl.
-rw-r--r--daemons/clvmd/clvmd.c3
-rw-r--r--libdaemon/server/daemon-server.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index f74490a..ac465d9 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -2155,7 +2155,8 @@ static int open_local_sock(void)
/* Set Close-on-exec & non-blocking */
if (fcntl(local_socket, F_SETFD, 1))
DEBUGLOG("setting CLOEXEC on local_socket failed: %s\n", strerror(errno));
- fcntl(local_socket, F_SETFL, fcntl(local_socket, F_GETFL, 0) | O_NONBLOCK);
+ if (fcntl(local_socket, F_SETFL, fcntl(local_socket, F_GETFL, 0) | O_NONBLOCK))
+ DEBUGLOG("setting O_NONBLOCK on local_socket failed: %s\n", strerror(errno));
if (bind(local_socket, (struct sockaddr *) &sockaddr, sizeof(sockaddr))) {
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index df75ac7..ef26cbc 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -220,7 +220,8 @@ static int _open_socket(daemon_state s)
/* Set Close-on-exec & non-blocking */
if (fcntl(fd, F_SETFD, 1))
fprintf(stderr, "setting CLOEXEC on socket fd %d failed: %s\n", fd, strerror(errno));
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+ if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK))
+ fprintf(stderr, "setting O_NONBLOCK on socket fd %d failed: %s\n", fd, strerror(errno));
fprintf(stderr, "[D] creating %s\n", s.socket_path);
if (!dm_strncpy(sockaddr.sun_path, s.socket_path, sizeof(sockaddr.sun_path))) {