On Mon, 21 Mar 2011 12:50:28 +0200 Or Gerlitz <ogerlitz@xxxxxxxxxxxx> wrote: > >> + do { > [...] > >> + ret_sel = select(fds[0]+1, &rfds, NULL, NULL, &tv); > >> + } while (ret_sel < 0 && errno == EINTR); > >> + if (ret_sel <= 0) { /* error or timeout */ > >> + eprintf("timeout on redirect callback, \ > >> + terminating child pid %d\n", pid); > >> + kill(pid, SIGTERM); > >> + } > > > Why this is necessary before waitpid()? > > I thought that we need to make sure that fds[0] is readable (with > > a timeout) before calling read() for fds[0]. > > if the timeout expires and fds[0] isn't readable, we don't want to wait > to the child process anymore, so we must terminate it - else we could > hang on waitpid forever, something we wanted to avoid in the first place. I see, thanks. I need some style fixes: fujita@rose:~/git/tgt$ ./scripts/checkpatch.pl ~/Mail/kernel/stgt/2782 ERROR: need space after that ',' (ctx:VxO) #88: FILE: usr/tgtd.c:330: + FD_SET(fds[0],&rfds); ^ ERROR: need space before that '&' (ctx:OxV) #88: FILE: usr/tgtd.c:330: + FD_SET(fds[0],&rfds); ^ WARNING: line over 80 characters #113: FILE: usr/tgtd.c:351: + eprintf("failed to get the output from: %s\n", cmd); Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Please resend the fixed version. Thanks, -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html