From: Tommi Rantala <[email protected]>
Complain loudly if fork() fails.
---
tipc-pipe/tipc-pipe.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tipc-pipe/tipc-pipe.c b/tipc-pipe/tipc-pipe.c
index 6406d99..20781cf 100644
--- a/tipc-pipe/tipc-pipe.c
+++ b/tipc-pipe/tipc-pipe.c
@@ -346,11 +346,19 @@ again:
break;
case multi_server:
chkne(peer_sd = accept(tipc, 0, 0));
- if (!fork()) {
+ switch (fork()) {
+ case -1:
+ perror("fork() failed");
+ exit(EXIT_FAILURE);
+ case 0:
+ /* child */
ret = data_io(peer_sd);
shutdown(peer_sd, SHUT_RDWR);
close(peer_sd);
exit(0);
+ default:
+ /* parent */
+ break;
}
goto again;
default:
--
2.9.3
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion