]> granicus.if.org Git - strace/commit
If stdin/stdout aren't open on startup, open them to /dev/null
authorDenys Vlasenko <dvlasenk@redhat.com>
Mon, 8 Feb 2016 17:08:46 +0000 (18:08 +0100)
committerDenys Vlasenko <dvlasenk@redhat.com>
Mon, 8 Feb 2016 17:17:38 +0000 (18:17 +0100)
commit0736d4e1a31d5cf04fb6cb4b73b6e0a70b13df45
tree3a83fa1b0759fb7cbfc0275b60131278bba5fc85
parentc9f85b38766a0e14f4f035f6d702fe57b6b9110c
If stdin/stdout aren't open on startup, open them to /dev/null

Otherwise, -oLOGFILE may end up using one of them. This conflicts
with the previous change, which closes stdin/out in strace.

* strace.c (init): If fcntl(F_GETFD) fails on stdin or stdout,
sanitize them: open /dev/null and dup it until fds 0,1,2
are all used up.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
strace.c