diff options
Diffstat (limited to 'source3/tests/unixsock.c')
-rw-r--r-- | source3/tests/unixsock.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/source3/tests/unixsock.c b/source3/tests/unixsock.c index f2765d68f6..ba384ae362 100644 --- a/source3/tests/unixsock.c +++ b/source3/tests/unixsock.c @@ -1,4 +1,5 @@ -/* -*- c-file-style: "linux" -*- +/* + * -*- c-file-style: "linux" -*- * * Try creating a Unix-domain socket, opening it, and reading from it. * The POSIX name for these is AF_LOCAL/PF_LOCAL. @@ -8,15 +9,17 @@ * on which they are broken under some conditions, such as RedHat 7.0 * (unpatched). We can't build WinBind there at the moment. * - * Coding standard says to always use exit() for this, not return, so - * we do. - * - * Martin Pool <mbp@samba.org>, June 2000. */ + * Martin Pool <mbp@samba.org>, June 2000. + */ /* TODO: Look for AF_LOCAL (most standard), AF_UNIX, and AF_FILE. */ #include <stdio.h> +#if defined(HAVE_UNISTD_H) +#include <unistd.h> +#endif + #ifdef HAVE_SYS_SOCKET_H # include <sys/socket.h> #endif @@ -48,7 +51,7 @@ static int bind_socket(char const *filename) /* Create the socket. */ if ((sock_fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) { perror ("socket(PF_LOCAL, SOCK_STREAM)"); - exit(1); + return 1; } /* Bind a name to the socket. */ @@ -67,7 +70,7 @@ static int bind_socket(char const *filename) if (bind(sock_fd, (struct sockaddr *) &name, size) < 0) { perror ("bind"); - exit(1); + return 1; } return sock_fd; @@ -84,10 +87,10 @@ int main(void) alarm(15); /* secs */ if ((sock_fd = bind_socket(filename)) < 0) - exit(1); + return 1; /* the socket will be deleted when autoconf cleans up these files. */ - exit(0); + return 0; } |