Introduction
Introduction Statistics Contact Development Disclaimer Help
Fixing the socket handling and add signals to clients. - geomyidae - A small C-…
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri…
Log
Files
Refs
Tags
README
LICENSE
---
commit dde23cfc01e8301d4263976f711f616f156932f7
parent 8e2c7276d2fa5fd44602707bd0621e0a91646bb8
Author: Christoph Lohmann <[email protected]>
Date: Sat, 21 Jul 2012 20:58:29 +0200
Fixing the socket handling and add signals to clients.
Diffstat:
M handlr.c | 4 ----
M main.c | 9 ++++++++-
2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/handlr.c b/handlr.c
@@ -163,8 +163,6 @@ handlecgi(int sock, char *file, char *port, char *base, cha…
wait(NULL);
if (path != nil)
free(path);
- shutdown(sock, SHUT_RDWR);
- close(sock);
break;
}
}
@@ -228,8 +226,6 @@ handledcgi(int sock, char *file, char *port, char *base, ch…
wait(NULL);
if (path != nil)
free(path);
- shutdown(sock, SHUT_RDWR);
- close(sock);
break;
}
}
diff --git a/main.c b/main.c
@@ -421,9 +421,15 @@ main(int argc, char *argv[])
switch(fork()) {
case -1:
perror("fork");
- close(sock);
+ shutdown(sock, SHUT_RDWR);
break;
case 0:
+ signal(SIGHUP, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGTERM, SIG_DFL);
+ signal(SIGALRM, SIG_DFL);
+
handlerequest(sock, base, ohost, sport, clienth,
clientp);
shutdown(sock, SHUT_RDWR);
@@ -432,6 +438,7 @@ main(int argc, char *argv[])
default:
break;
}
+ close(sock);
}
shutdown(listfd, SHUT_RDWR);
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.