* PATCH: FD_CLOEXEC
@ 2000-05-25 9:44 Peter Stephenson
2000-05-25 15:01 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2000-05-25 9:44 UTC (permalink / raw)
To: Zsh hackers list
I was thinking about the command substitution problem and keeping file
descriptors open when I checked up on the use of the close-on-exec flag in
zftp.c, which is the only place it's used (could we do with some more?)
I noticed I was using it with pointers instead of integers; goodness knows
why, except there's no type checking on that argument. I confirmed by
experiment on Solaris that it wants the actual integer (easy to test, since
FD_CLOEXEC is 1 and pointers are even).
I developed zftp under AIX, so it's just possible something funny is going
on there. Maybe Oliver could check it at least compiles?
Index: Src/Modules/zftp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zftp.c,v
retrieving revision 1.3
diff -u -r1.3 zftp.c
--- Src/Modules/zftp.c 2000/05/09 17:49:30 1.3
+++ Src/Modules/zftp.c 2000/05/25 09:41:43
@@ -1303,8 +1303,7 @@
#endif
#if defined(F_SETFD) && defined(FD_CLOEXEC)
/* If the shell execs a program, we don't want this fd left open. */
- len = FD_CLOEXEC;
- fcntl(zfsess->dfd, F_SETFD, &len);
+ fcntl(zfsess->dfd, F_SETFD, FD_CLOEXEC);
#endif
return 0;
@@ -1988,8 +1987,7 @@
#if defined(F_SETFD) && defined(FD_CLOEXEC)
/* If the shell execs a program, we don't want this fd left open. */
- len = FD_CLOEXEC;
- fcntl(zfsess->cfd, F_SETFD, &len);
+ fcntl(zfsess->cfd, F_SETFD, FD_CLOEXEC);
#endif
len = sizeof(zfsess->sock);
@@ -2057,8 +2055,7 @@
DPUTS(zfstatfd == -1, "zfstatfd not created");
#if defined(F_SETFD) && defined(FD_CLOEXEC)
/* If the shell execs a program, we don't want this fd left open. */
- len = FD_CLOEXEC;
- fcntl(zfstatfd, F_SETFD, &len);
+ fcntl(zfstatfd, F_SETFD, FD_CLOEXEC);
#endif
unlink(fname);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-05-25 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-25 9:44 PATCH: FD_CLOEXEC Peter Stephenson
2000-05-25 15:01 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).