set CLOEXEC flag for outputfile

This commit is contained in:
Wichert Akkerman 2001-08-03 11:43:35 +00:00
parent 7b96b57b7d
commit 54b4f79216
2 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2001-08-03 Wichert Akkerman <wakkerma@debian.org>
* strace.c: set CLOEXEC flag for outputfile
2001-08-03 Wichert Akkerman <wakkerma@debian.org>
* linux/sparc/syscall.h, linux/sparc/syscallent.h: add some LFS calls

View File

@ -314,11 +314,23 @@ char *argv[];
/* Check if they want to redirect the output. */
if (outfname) {
long f;
if ((outf = fopen(outfname, "w")) == NULL) {
fprintf(stderr, "%s: can't fopen '%s': %s\n",
progname, outfname, strerror(errno));
exit(1);
}
if ((f=fcntl(fileno(outf), F_GETFD)) < 0 ) {
perror("failed to get flags for outputfile");
exit(1);
}
if (fcntl(fileno(outf), F_SETFD, f|FD_CLOEXEC) < 0 ) {
perror("failed to set flags for outputfile");
exit(1);
}
}
#ifndef SVR4