Explorar el Código

Fixed listen_on_socket

Yannick Ulrich hace 3 años
padre
commit
c9b3ebafe1
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      main.c

+ 3 - 0
main.c

@@ -53,6 +53,9 @@ listen_on_socket()
         return 0;
     }
 
+    memset(&addr, 0, sizeof(struct sockaddr_un));
+    addr.sun_family = AF_UNIX;
+    strncpy(addr.sun_path, socket_path, sizeof(addr.sun_path) - 1);
     if (bind(sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_un)) < 0) {
         err("failed to bind socket");
         return 0;