diff options
author | Chip Salzenberg <chip@perl.com> | 1997-02-10 11:36:54 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-02-11 07:29:00 +1200 |
commit | 360e57411903f2d16ad89bcdf4a462fc97239653 (patch) | |
tree | 545be8efc95aec36642a14df3c3b283562618b48 /doio.c | |
parent | c20f90abda55ce82c41ec2d4843f6344c4730aa2 (diff) | |
download | perl-360e57411903f2d16ad89bcdf4a462fc97239653.tar.gz |
On C<sysopen(..., O_APPEND)>, call C<fopen(..., "a")>
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -118,9 +118,16 @@ PerlIO *supplied_fp; if (fd == -1) fp = NULL; else { - fp = PerlIO_fdopen(fd, ((result == 0) ? "r" - : (result == 1) ? "w" - : "r+")); + char *fpmode; + if (result == 0) + fpmode = "r"; +#ifdef O_APPEND + else if (rawmode & O_APPEND) + fpmode = (result == 1) ? "a" : "a+"; +#endif + else + fpmode = (result == 1) ? "w" : "r+"; + fp = PerlIO_fdopen(fd, fpmode); if (!fp) close(fd); } |