diff options
author | David Barksdale <amatus.amongus@gmail.com> | 2016-10-26 18:16:44 +0000 |
---|---|---|
committer | David Barksdale <amatus.amongus@gmail.com> | 2016-10-26 18:16:44 +0000 |
commit | 466456330475aeb89e863f695a7e1ef0c312901d (patch) | |
tree | c41c938ec51a50d55aeaa562af9624a97e53d243 /src/util | |
parent | dd88153891b488a5ab54480ee2a10e45817ffd56 (diff) | |
download | gnunet-466456330475aeb89e863f695a7e1ef0c312901d.tar.gz gnunet-466456330475aeb89e863f695a7e1ef0c312901d.zip |
This can't be NULL
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/network.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/util/network.c b/src/util/network.c index 7f02395c6..5aeb0157b 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -518,11 +518,10 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc, | |||
518 | /* set permissions of newly created non-abstract UNIX domain socket to | 518 | /* set permissions of newly created non-abstract UNIX domain socket to |
519 | "user-only"; applications can choose to relax this later */ | 519 | "user-only"; applications can choose to relax this later */ |
520 | mode_t old_mask = 0; /* assigned to make compiler happy */ | 520 | mode_t old_mask = 0; /* assigned to make compiler happy */ |
521 | const struct sockaddr_un *un; | 521 | const struct sockaddr_un *un = (const struct sockaddr_un *) address; |
522 | int not_abstract = 0; | 522 | int not_abstract = 0; |
523 | 523 | ||
524 | if ((AF_UNIX == address->sa_family) | 524 | if ((AF_UNIX == address->sa_family) |
525 | && (NULL != (un = (const struct sockaddr_un *) address)->sun_path) | ||
526 | && ('\0' != un->sun_path[0]) ) /* Not an abstract socket */ | 525 | && ('\0' != un->sun_path[0]) ) /* Not an abstract socket */ |
527 | not_abstract = 1; | 526 | not_abstract = 1; |
528 | if (not_abstract) | 527 | if (not_abstract) |
@@ -580,13 +579,12 @@ GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc) | |||
580 | ret = close (desc->fd); | 579 | ret = close (desc->fd); |
581 | #endif | 580 | #endif |
582 | #ifndef WINDOWS | 581 | #ifndef WINDOWS |
583 | const struct sockaddr_un *un; | 582 | const struct sockaddr_un *un = (const struct sockaddr_un *) desc->addr; |
584 | 583 | ||
585 | /* Cleanup the UNIX domain socket and its parent directories in case of non | 584 | /* Cleanup the UNIX domain socket and its parent directories in case of non |
586 | abstract sockets */ | 585 | abstract sockets */ |
587 | if ( (AF_UNIX == desc->af) && | 586 | if ( (AF_UNIX == desc->af) && |
588 | (NULL != desc->addr) && | 587 | (NULL != desc->addr) && |
589 | (NULL != (un = (const struct sockaddr_un *) desc->addr)->sun_path) && | ||
590 | ('\0' != un->sun_path[0]) ) | 588 | ('\0' != un->sun_path[0]) ) |
591 | { | 589 | { |
592 | char *dirname = GNUNET_strndup (un->sun_path, | 590 | char *dirname = GNUNET_strndup (un->sun_path, |