udev: handle sd_is_socket() failure
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 25 Oct 2018 08:39:53 +0000 (17:39 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 12 Nov 2018 14:25:59 +0000 (23:25 +0900)
src/udev/udevd.c

index 1a643d5..cc3fdd8 100644 (file)
@@ -1368,14 +1368,14 @@ static int listen_fds(int *rctrl, int *rnetlink) {
                 return n;
 
         for (fd = SD_LISTEN_FDS_START; fd < n + SD_LISTEN_FDS_START; fd++) {
-                if (sd_is_socket(fd, AF_LOCAL, SOCK_SEQPACKET, -1)) {
+                if (sd_is_socket(fd, AF_LOCAL, SOCK_SEQPACKET, -1) > 0) {
                         if (ctrl_fd >= 0)
                                 return -EINVAL;
                         ctrl_fd = fd;
                         continue;
                 }
 
-                if (sd_is_socket(fd, AF_NETLINK, SOCK_RAW, -1)) {
+                if (sd_is_socket(fd, AF_NETLINK, SOCK_RAW, -1) > 0) {
                         if (netlink_fd >= 0)
                                 return -EINVAL;
                         netlink_fd = fd;