odhcpd: Check if open the ioctl socket failed
authorHyeonsik Song <blogcin@naver.com>
Thu, 5 Jul 2018 01:45:37 +0000 (10:45 +0900)
committerHans Dedecker <dedeckeh@gmail.com>
Thu, 5 Jul 2018 09:40:43 +0000 (11:40 +0200)
Signed-off-by: Hyeonsik Song <blogcin@naver.com>
src/odhcpd.c

index 9ab849aa75086a9e8d9b8b50b7f97284ecf45115..fe4dd732731bcc6405b5839fce77e59b87df5866 100644 (file)
@@ -91,6 +91,9 @@ int main(int argc, char **argv)
 
        ioctl_sock = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
 
+       if (ioctl_sock < 0)
+               return 4;
+
        if ((urandom_fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC)) < 0)
                return 4;