unix.7: Correct example

The example is misleading. It is not a good idea to unlink an
existing socket because we might try to start the server multiple
times. In this case it is preferable to receive an error.

We could add code that removes the socket when the server process
is killed but that would stretch the example too far.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Heinrich Schuchardt 2018-06-27 03:09:05 +02:00 committed by Michael Kerrisk
parent f4ba6a215f
commit 18bbb297eb
1 changed files with 0 additions and 7 deletions

View File

@ -934,13 +934,6 @@ main(int argc, char *argv[])
int result;
char buffer[BUFFER_SIZE];
/*
* In case the program exited inadvertently on the last run,
* remove the socket.
*/
unlink(SOCKET_NAME);
/* Create local socket. */
connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);