set CLOEXEC flag for outputfile
This commit is contained in:
parent
7b96b57b7d
commit
54b4f79216
@ -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
|
||||
|
12
strace.c
12
strace.c
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user