Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37517201
en ru br
ALT Linux repos
S:5.45-alt1
D:4.20-alt5.1
5.0: 4.26-alt2
4.1: 4.20-alt5
4.0: 4.20-alt5
3.0: 4.13-alt1

Other repositories
Upstream:4.23

Group :: File tools
RPM: file

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: file-4.13-rh-alt-compress.patch
Download


--- file-4.13.orig/src/compress.c	2005-01-07 22:17:26 +0300
+++ file-4.13/src/compress.c	2005-02-12 18:02:16 +0300
@@ -314,6 +314,7 @@ uncompressbuf(struct magic_set *ms, int 
     const unsigned char *old, unsigned char **newch, size_t n)
 {
 	int fdin[2], fdout[2];
+	pid_t pid1 = -1, pid2 = -1;
 	int r;
 
 #ifdef HAVE_LIBZ
@@ -327,7 +328,7 @@ uncompressbuf(struct magic_set *ms, int 
 		file_error(ms, errno, "cannot create pipe");	
 		return 0;
 	}
-	switch (fork()) {
+	switch ((pid1=fork())) {
 	case 0:	/* child */
 		(void) close(0);
 		if (fd != -1) {
@@ -368,7 +369,7 @@ uncompressbuf(struct magic_set *ms, int 
 			 * fork again, to avoid blocking because both
 			 * pipes filled
 			 */
-			switch (fork()) {
+			switch ((pid2=fork())) {
 			case 0: /* child */
 				(void)close(fdout[0]);
 				if (swrite(fdin[1], old, n) != n) {
@@ -423,12 +424,8 @@ err:
 		if (fdin[1] != -1)
 			(void) close(fdin[1]);
 		(void) close(fdout[0]);
-#ifdef WNOHANG
-		while (waitpid(-1, NULL, WNOHANG) != -1)
-			continue;
-#else
-		(void)wait(NULL);
-#endif
+		waitpid(pid1, NULL, 0);
+		waitpid(pid2, NULL, 0);
 		return n;
 	}
 }
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin