Skip to contentSkip to conversation

master - clvmd,lvmetad: check for fcntl result

PATCH Zdenek Kabelac 1 participant 1 message Aug 23, 2012

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c6f680ee4945f22670d133ba341bb670c1d0a474
Commit:        c6f680ee4945f22670d133ba341bb670c1d0a474
Parent:        5d0e7fb4edbe2c4e999eaa6210b6c9e25bdd5e91
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Jun 20 10:49:16 2012 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Thu Aug 23 14:38:48 2012 +0200

clvmd,lvmetad: check for fcntl result

Report any problem of fcntl.

---
 daemons/clvmd/clvmd.c            |    3 ++-
 libdaemon/server/daemon-server.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
daemons/clvmd/clvmd.c +2 -1
index f74490a..ac465d9 100644
@@ -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))) {
libdaemon/server/daemon-server.c +2 -1
index df75ac7..ef26cbc 100644
@@ -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))) {