Browse code

sigtool: redirect stdout and stderr to /dev/null before calling /bin/tar

git-svn: trunk@2192

Tomasz Kojm authored on 2006/08/13 06:19:25
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sat Aug 12 23:16:05 CEST 2006 (tk)
2
+----------------------------------
3
+  * sigtool/sigtool.c: build(): redirect stdout and stderr to /dev/null before
4
+		       calling /bin/tar
5
+
1 6
 Fri Aug 11 19:37:24 CEST 2006 (acab)
2 7
 ------------------------------------
3 8
   * libclamav: add support for SUE decryption (disabled)
... ...
@@ -319,7 +319,7 @@ static int verifycdiff(const char *diff, const char *cvd, const char *incdir);
319 319
 
320 320
 static int build(struct optstruct *opt)
321 321
 {
322
-	int ret, inc = 1;
322
+	int ret, inc = 1, dn;
323 323
 	size_t bytes;
324 324
 	unsigned int sigs = 0, oldsigs = 0, lines = 0, version, real_header;
325 325
 	struct stat foo;
... ...
@@ -484,8 +484,15 @@ static int build(struct optstruct *opt)
484 484
 				 "daily.fp", "daily.info", "main.info", NULL };
485 485
 		args[2] = tarfile;
486 486
 		if(!opt_check(opt, "debug")) {
487
-		    close(1);
488
-		    close(2);
487
+		    if((dn = open("/dev/null", O_WRONLY)) == -1) {
488
+			mprintf("^Cannot open /dev/null\n");
489
+			close(1);
490
+			close(2);
491
+		    } else {
492
+			dup2(dn, 1);
493
+			dup2(dn, 2);
494
+			close(dn);
495
+		    }
489 496
 		}
490 497
 		execv("/bin/tar", args);
491 498
 		mprintf("!build: Can't execute tar\n");