projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't print connect error upon failure
[lttng-tools.git]
/
liblttsessiondcomm
/
liblttsessiondcomm.c
diff --git
a/liblttsessiondcomm/liblttsessiondcomm.c
b/liblttsessiondcomm/liblttsessiondcomm.c
index 253e63545addf17710baeecc679d37fa05d11aae..cffeb72c0d71f0d9ead2b6a61f4ac78ebf18d875 100644
(file)
--- a/
liblttsessiondcomm/liblttsessiondcomm.c
+++ b/
liblttsessiondcomm/liblttsessiondcomm.c
@@
-115,11
+115,12
@@
int lttcomm_connect_unix_sock(const char *pathname)
{
struct sockaddr_un sun;
int fd;
{
struct sockaddr_un sun;
int fd;
- int ret
= 1
;
+ int ret;
fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
+ ret = fd;
goto error;
}
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) {
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;
}
return fd;
+error_connect:
+ close(fd);
error:
error:
- return
-1
;
+ return
ret
;
}
/*
}
/*
@@
-186,6
+193,8
@@
int lttcomm_create_unix_sock(const char *pathname)
sun.sun_family = AF_UNIX;
strncpy(sun.sun_path, pathname, strlen(pathname));
sun.sun_family = AF_UNIX;
strncpy(sun.sun_path, pathname, strlen(pathname));
+ /* Unlink the old file if present */
+ (void) unlink(pathname);
ret = bind(fd, (struct sockaddr *) &sun, sizeof(sun));
if (ret < 0) {
perror("bind");
ret = bind(fd, (struct sockaddr *) &sun, sizeof(sun));
if (ret < 0) {
perror("bind");
@@
-299,8
+308,8
@@
ssize_t lttcomm_send_fds_unix_sock(int sock, void *buf, int *fds, size_t nb_fd,
char tmp[CMSG_SPACE(sizeof_fds)];
/*
char tmp[CMSG_SPACE(sizeof_fds)];
/*
- * Note: the consumerd receiver only supports receiving one FD
at a
- *
time for now
.
+ * Note: the consumerd receiver only supports receiving one FD
per
+ *
message
.
*/
assert(nb_fd == 1);
*/
assert(nb_fd == 1);
This page took
0.023769 seconds
and
4
git commands to generate.