All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: dm-devel@redhat.com
Subject: [PATCH 1/9] Clarify uxsock logging
Date: Tue, 26 Nov 2013 12:41:22 +0100	[thread overview]
Message-ID: <1385466090-24290-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1385466090-24290-1-git-send-email-hare@suse.de>

Socket creation might fail on various stages, so print out a
proper logging message.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/uxsock.c | 11 +++++++++--
 multipathd/uxclnt.c   |  4 +---
 multipathd/uxlsnr.c   |  4 +---
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/libmultipath/uxsock.c b/libmultipath/uxsock.c
index fcad56e..e93edff 100644
--- a/libmultipath/uxsock.c
+++ b/libmultipath/uxsock.c
@@ -19,6 +19,7 @@
 
 #include "memory.h"
 #include "uxsock.h"
+#include "debug.h"
 
 /*
  * connect to a unix domain socket
@@ -36,10 +37,12 @@ int ux_socket_connect(const char *name)
 
 	fd = socket(AF_LOCAL, SOCK_STREAM, 0);
 	if (fd == -1) {
+		condlog(3, "Couldn't create ux_socket, error %d", errno);
 		return -1;
 	}
 
 	if (connect(fd, (struct sockaddr *)&addr, len) == -1) {
+		condlog(3, "Couldn't connect to ux_socket, error %d", errno);
 		close(fd);
 		return -1;
 	}
@@ -57,7 +60,10 @@ int ux_socket_listen(const char *name)
 	struct sockaddr_un addr;
 
 	fd = socket(AF_LOCAL, SOCK_STREAM, 0);
-	if (fd == -1) return -1;
+	if (fd == -1) {
+		condlog(3, "Couldn't create ux_socket, error %d", errno);
+		return -1;
+	}
 
 	memset(&addr, 0, sizeof(addr));
 	addr.sun_family = AF_LOCAL;
@@ -66,15 +72,16 @@ int ux_socket_listen(const char *name)
 	strncpy(&addr.sun_path[1], name, len);
 
 	if (bind(fd, (struct sockaddr *)&addr, len) == -1) {
+		condlog(3, "Couldn't bind to ux_socket, error %d", errno);
 		close(fd);
 		return -1;
 	}
 
 	if (listen(fd, 10) == -1) {
+		condlog(3, "Couldn't listen to ux_socket, error %d", errno);
 		close(fd);
 		return -1;
 	}
-
 	return fd;
 }
 
diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c
index 3e4e381..e86be21 100644
--- a/multipathd/uxclnt.c
+++ b/multipathd/uxclnt.c
@@ -121,10 +121,8 @@ int uxclnt(char * inbuf)
 	int fd;
 
 	fd = ux_socket_connect(DEFAULT_SOCKET);
-	if (fd == -1) {
-		perror("ux_socket_connect");
+	if (fd == -1)
 		exit(1);
-	}
 
 	if (inbuf)
 		process_req(fd, inbuf);
diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c
index c0ddd8d..ed8e012 100644
--- a/multipathd/uxlsnr.c
+++ b/multipathd/uxlsnr.c
@@ -112,10 +112,8 @@ void * uxsock_listen(int (*uxsock_trigger)(char *, char **, int *, void *),
 
 	ux_sock = ux_socket_listen(DEFAULT_SOCKET);
 
-	if (ux_sock == -1) {
-		condlog(0, "ux_socket_listen error");
+	if (ux_sock == -1)
 		exit(1);
-	}
 
 	pthread_cleanup_push(uxsock_cleanup, NULL);
 
-- 
1.8.1.4

  reply	other threads:[~2013-11-26 11:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 11:41 [PATCH 0/9] multipath systemd integration Hannes Reinecke
2013-11-26 11:41 ` Hannes Reinecke [this message]
2013-11-26 11:41 ` [PATCH 2/9] Use system-provided regex implementation Hannes Reinecke
2013-11-26 11:41 ` [PATCH 3/9] multipathd: Add option '-s' to suppress timestamps Hannes Reinecke
2013-11-26 11:41 ` [PATCH 4/9] multipathd: switch to socket activation for systemd Hannes Reinecke
2013-11-26 11:41 ` [PATCH 5/9] multipathd: use sd_notify() to inform systemd Hannes Reinecke
2013-11-26 11:41 ` [PATCH 6/9] multipathd: Implement systemd watchdog integration Hannes Reinecke
2013-11-26 18:41   ` Benjamin Marzinski
2013-11-27  7:05     ` Hannes Reinecke
2013-11-26 11:41 ` [PATCH 7/9] multipathd: enable core dumps for systemd Hannes Reinecke
2013-11-26 11:41 ` [PATCH 8/9] multipathd: Read environment variables from systemd Hannes Reinecke
2013-11-26 11:41 ` [PATCH 9/9] multipathd: measure path check time Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385466090-24290-2-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=christophe.varoqui@gmail.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.