aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-07-01 15:42:51 +0000
committerChristian Grothoff <christian@grothoff.org>2010-07-01 15:42:51 +0000
commitdc196695653457ad6dace5de527f2d556eb76d7d (patch)
tree8244d8c2cf4255a28a2eb5cf2b144431600b8eb9 /src
parent5761831e7787b0b4db46ef0a59d09b731d081155 (diff)
downloadgnunet-dc196695653457ad6dace5de527f2d556eb76d7d.tar.gz
gnunet-dc196695653457ad6dace5de527f2d556eb76d7d.zip
unlink on bind
Diffstat (limited to 'src')
-rw-r--r--src/util/network.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/util/network.c b/src/util/network.c
index 37e40aa1a..101e794d0 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -41,14 +41,6 @@ struct GNUNET_NETWORK_Handle
41#ifndef MINGW 41#ifndef MINGW
42 int fd; 42 int fd;
43 43
44#ifndef LINUX
45 /**
46 * For UNIX domain listen sockets, underlying filename to be removed
47 * on close.
48 */
49 char *filename;
50#endif
51
52#else 44#else
53 SOCKET fd; 45 SOCKET fd;
54#endif 46#endif
@@ -273,7 +265,10 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
273 if ( (ret == 0) && (address->sa_family == AF_UNIX)) 265 if ( (ret == 0) && (address->sa_family == AF_UNIX))
274 { 266 {
275 const struct sockaddr_un *un = (const struct sockaddr_un*) address; 267 const struct sockaddr_un *un = (const struct sockaddr_un*) address;
276 desc->filename = GNUNET_strdup (un->sun_path); 268 if (0 != unlink (un->sun_path))
269 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
270 "unlink",
271 un->sun_path);
277 } 272 }
278#endif 273#endif
279#endif 274#endif
@@ -296,16 +291,6 @@ GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc)
296 SetErrnoFromWinsockError (WSAGetLastError ()); 291 SetErrnoFromWinsockError (WSAGetLastError ());
297#else 292#else
298 ret = close (desc->fd); 293 ret = close (desc->fd);
299#ifndef LINUX
300 if (NULL != desc->filename)
301 {
302 if (0 != unlink (desc->filename))
303 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
304 "unlink",
305 desc->filename);
306 GNUNET_free (desc->filename);
307 }
308#endif
309#endif 294#endif
310 GNUNET_free (desc); 295 GNUNET_free (desc);
311 return (ret == 0) ? GNUNET_OK : GNUNET_SYSERR; 296 return (ret == 0) ? GNUNET_OK : GNUNET_SYSERR;