Use sizeof() to get size of sun_path.

- Size varies on platforms, OSX has 104, Linux has 108.
This commit is contained in:
Jesper Lyager Nielsen 2015-06-17 11:04:57 +02:00
parent 0faf9f80b7
commit de5d6de0c8

2
main.c
View File

@ -939,7 +939,7 @@ int main (int argc, char **argv) {
serv_addr.sun_family = AF_UNIX;
snprintf (serv_addr.sun_path, 108, "%s", unix_socket);
snprintf (serv_addr.sun_path, sizeof(serv_addr.sun_path), "%s", unix_socket);
if (bind (usfd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) {
perror ("bind");