[hackers] [sbase] simpler nohup || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Fri, 24 Jun 2011 09:33:29 +0200 (CEST)

changeset: 94:83c91ed2e467
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Fri Jun 24 08:33:08 2011 +0100
files: nohup.c
description:
simpler nohup

diff -r 0021d9f2b4e6 -r 83c91ed2e467 nohup.c
--- a/nohup.c Thu Jun 23 02:08:41 2011 +0100
+++ b/nohup.c Fri Jun 24 08:33:08 2011 +0100
@@ -13,16 +13,14 @@
 main(int argc, char *argv[])
 {
         int fd;
- struct sigaction sa;
 
         if(getopt(argc, argv, "") != -1)
                 exit(Error);
         if(optind == argc)
                 enprintf(Error, "usage: %s command [argument...]\n", argv[0]);
 
- sa.sa_handler = SIG_IGN;
- if(sigaction(SIGHUP, &sa, NULL) == -1)
- enprintf(Error, "sigaction HUP:");
+ if(signal(SIGHUP, SIG_IGN) == SIG_ERR)
+ enprintf(Error, "signal HUP:");
         if(isatty(STDOUT_FILENO)) {
                 if((fd = open("nohup.out", O_APPEND|O_CREAT, S_IRUSR|S_IWUSR)) == -1)
                         enprintf(Error, "open nohup.out:");
Received on Fri Jun 24 2011 - 09:33:29 CEST

This archive was generated by hypermail 2.2.0 : Fri Jun 24 2011 - 09:36:05 CEST