Fossil SCM
Another attempt to fix the harmless compiler warning in popen2().
Commit
b1483634c6284812e16127294e569c2dcf7efaa4418d5bc69447a0c02230f994
Parent
beec145ff3e3c85…
1 file changed
+3
-1
+3
-1
| --- src/popen.c | ||
| +++ src/popen.c | ||
| @@ -198,11 +198,13 @@ | ||
| 198 | 198 | close(1); |
| 199 | 199 | fd = dup(pin[1]); |
| 200 | 200 | if( fd!=1 ) fossil_panic("popen() failed to open file descriptor 1"); |
| 201 | 201 | close(pin[0]); |
| 202 | 202 | close(pin[1]); |
| 203 | - close(2); (void)dup(1); /* Redirect stderr into the stdout pipe */ | |
| 203 | + close(2); | |
| 204 | + fd = dup(1); | |
| 205 | + if( fd!=2 ) fossil_panic("popen() failed to redirect stderr into stdout"); | |
| 204 | 206 | if( bDirect ){ |
| 205 | 207 | execl(zCmd, zCmd, (char*)0); |
| 206 | 208 | }else{ |
| 207 | 209 | execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0); |
| 208 | 210 | } |
| 209 | 211 |
| --- src/popen.c | |
| +++ src/popen.c | |
| @@ -198,11 +198,13 @@ | |
| 198 | close(1); |
| 199 | fd = dup(pin[1]); |
| 200 | if( fd!=1 ) fossil_panic("popen() failed to open file descriptor 1"); |
| 201 | close(pin[0]); |
| 202 | close(pin[1]); |
| 203 | close(2); (void)dup(1); /* Redirect stderr into the stdout pipe */ |
| 204 | if( bDirect ){ |
| 205 | execl(zCmd, zCmd, (char*)0); |
| 206 | }else{ |
| 207 | execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0); |
| 208 | } |
| 209 |
| --- src/popen.c | |
| +++ src/popen.c | |
| @@ -198,11 +198,13 @@ | |
| 198 | close(1); |
| 199 | fd = dup(pin[1]); |
| 200 | if( fd!=1 ) fossil_panic("popen() failed to open file descriptor 1"); |
| 201 | close(pin[0]); |
| 202 | close(pin[1]); |
| 203 | close(2); |
| 204 | fd = dup(1); |
| 205 | if( fd!=2 ) fossil_panic("popen() failed to redirect stderr into stdout"); |
| 206 | if( bDirect ){ |
| 207 | execl(zCmd, zCmd, (char*)0); |
| 208 | }else{ |
| 209 | execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0); |
| 210 | } |
| 211 |