Skip to contentSkip to conversation

jobs: Add comment about reset_input in forkchild

PATCH New Herbert Xu 1 participant 1 message Jul 24, 2024

lore
Share & tools
lore

Herbert Xu

author
#0 lore raw

PATCH 1/1 jobs: Add comment about reset_input in forkchild

For background jobs where the stdin is redirected to /dev/null, a reset_input may be needed in future. For the time being there is no reason to do this as all possible states for stdin will work correctly with /dev/null.

---
 src/jobs.c | 3 +++
 1 file changed, 3 insertions(+)
src/jobs.c +3 -0
index 247fab5..51e6fa1 100644
@@ -904,6 +904,9 @@ static void forkchild(struct job *jp, union node *n, int mode)
 		if (jp->nprocs == 0) {
 			close(0);
 			sh_open(_PATH_DEVNULL, O_RDONLY, 0);
+			/* Should call reset_input here, but it's harmless
+			 * for now.
+			 */
 		}
 	}
 	if (!oldlvl && iflag) {
Signature · 6 lines
2.39.2

-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt