X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Funix.cpp;h=0548aaccbab6fccce6f98093cf7c98cceca4ebf7;hb=bd02bf8b4c749cd7097b6a7364a1b7cb49cefcec;hp=4861b8ea139ae64b10bb4c0328bafc56d08587cc;hpb=4eac90eb7d8428fc6c5a75d3f0e795844fb6c574;p=lttng-tools.git diff --git a/src/common/unix.cpp b/src/common/unix.cpp index 4861b8ea1..0548aaccb 100644 --- a/src/common/unix.cpp +++ b/src/common/unix.cpp @@ -15,12 +15,12 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include -#include "unix.h" +#include "unix.hpp" /* * Connect to unix socket using the path name. @@ -379,7 +379,16 @@ int lttcomm_close_unix_sock(int sock) /* Shutdown receptions and transmissions */ ret = shutdown(sock, SHUT_RDWR); if (ret < 0) { - PERROR("shutdown"); + /* + * The socket is already disconnected, don't error out. + * This doesn't happen on Linux, but it does on FreeBSD, see: + * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227259 + */ + if (errno == ENOTCONN) { + ret = 0; + } else { + PERROR("shutdown"); + } } closeret = close(sock);