Rev 5197 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5197 | Rev 5199 | ||
---|---|---|---|
Line 67... | Line 67... | ||
67 | /* Mark FILE as close-on-exec. Return FILE. FILE may be NULL, in |
67 | /* Mark FILE as close-on-exec. Return FILE. FILE may be NULL, in |
68 | which case nothing is done. */ |
68 | which case nothing is done. */ |
69 | static FILE * |
69 | static FILE * |
70 | close_on_exec (FILE *file) |
70 | close_on_exec (FILE *file) |
71 | { |
71 | { |
72 | #if defined (HAVE_FILENO) && defined (F_GETFD) |
- | |
73 | if (file) |
- | |
74 | { |
- | |
75 | int fd = fileno (file); |
- | |
76 | int old = fcntl (fd, F_GETFD, 0); |
- | |
77 | if (old >= 0) |
- | |
78 | fcntl (fd, F_SETFD, old | FD_CLOEXEC); |
- | |
79 | } |
- | |
80 | #endif |
- | |
81 | return file; |
72 | return file; |
82 | } |
73 | } |
Line 83... | Line 74... | ||
83 | 74 | ||
84 | FILE * |
75 | FILE * |