Don't print connect error upon failure
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 8 Aug 2011 16:07:40 +0000 (12:07 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 8 Aug 2011 16:07:40 +0000 (12:07 -0400)
Used in normal operation, should not print error.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttsessiondcomm/liblttsessiondcomm.c

index e7e4204339d61dc0b1daa97cdadd3b1c6fd8033c..cffeb72c0d71f0d9ead2b6a61f4ac78ebf18d875 100644 (file)
@@ -115,11 +115,12 @@ int lttcomm_connect_unix_sock(const char *pathname)
 {
        struct sockaddr_un sun;
        int fd;
-       int ret = 1;
+       int ret;
 
        fd = socket(PF_UNIX, SOCK_STREAM, 0);
        if (fd < 0) {
                perror("socket");
+               ret = fd;
                goto error;
        }
 
@@ -129,14 +130,20 @@ int lttcomm_connect_unix_sock(const char *pathname)
 
        ret = connect(fd, (struct sockaddr *) &sun, sizeof(sun));
        if (ret < 0) {
-               perror("connect");
-               goto error;
+               /*
+                * Don't print message on connect error, because connect
+                * is used in normal execution to detect if sessiond is
+                * alive.
+                */
+               goto error_connect;
        }
 
        return fd;
 
+error_connect:
+       close(fd);
 error:
-       return -1;
+       return ret;
 }
 
 /*
This page took 0.027103 seconds and 5 git commands to generate.