From: Peter Stephenson <pws@cambridgesiliconradio.com>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: FD_CLOEXEC
Date: Thu, 25 May 2000 10:44:01 +0100 [thread overview]
Message-ID: <0FV400JGT0DC95@la-la.cambridgesiliconradio.com> (raw)
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);
}
next reply other threads:[~2000-05-25 9:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-25 9:44 Peter Stephenson [this message]
2000-05-25 15:01 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0FV400JGT0DC95@la-la.cambridgesiliconradio.com \
--to=pws@cambridgesiliconradio.com \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).