summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1991-06-09 12:36:21 +0000
committerLarry Wall <lwall@netlabs.com>1991-06-09 12:36:21 +0000
commit1462b684862954f3522657efc93a3264698e4a9f (patch)
treec92554143d0076f4bd8a6f41f8caa3315eef035d /doio.c
parentd48672a2009b4897fb5bf74d6723c050cdd015e0 (diff)
downloadperl-1462b684862954f3522657efc93a3264698e4a9f.tar.gz
perl 4.0 patch 10: (combined patch)
Subject: pack(hh,1) dumped core Subject: read didn't work from character special files open for writing Subject: close-on-exec wrongly set on system file descriptors Subject: //g only worked first time through Subject: perl -v printed incorrect copyright notice Subject: certain pattern optimizations were botched Subject: documented some newer features in addenda Subject: $) and $| incorrectly handled in run-time patterns Subject: added tests for case-insensitive regular expressions Subject: m'$foo' now treats string as single quoted
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/doio.c b/doio.c
index e93c305e7c..2f1ea17491 100644
--- a/doio.c
+++ b/doio.c
@@ -1,4 +1,4 @@
-/* $RCSfile: doio.c,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:53:39 $
+/* $RCSfile: doio.c,v $$Revision: 4.0.1.3 $$Date: 91/06/10 01:21:19 $
*
* Copyright (c) 1991, Larry Wall
*
@@ -6,6 +6,10 @@
* License or the Artistic License, as specified in the README file.
*
* $Log: doio.c,v $
+ * Revision 4.0.1.3 91/06/10 01:21:19 lwall
+ * patch10: read didn't work from character special files open for writing
+ * patch10: close-on-exec wrongly set on system file descriptors
+ *
* Revision 4.0.1.2 91/06/07 10:53:39 lwall
* patch4: new copyright notice
* patch4: system fd's are now treated specially
@@ -237,17 +241,13 @@ int len;
(void)fclose(fp);
goto say_false;
}
- if (S_ISSOCK(statbuf.st_mode) || (S_ISCHR(statbuf.st_mode) && writing))
+ if (S_ISSOCK(statbuf.st_mode))
stio->type = 's'; /* in case a socket was passed in to us */
#ifdef S_IFMT
else if (!(statbuf.st_mode & S_IFMT))
stio->type = 's'; /* some OS's return 0 on fstat()ed socket */
#endif
}
-#if defined(HAS_FCNTL) && defined(F_SETFD)
- fd = fileno(fp);
- fcntl(fd,F_SETFD,fd > maxsysfd);
-#endif
if (saveifp) { /* must use old fp? */
fd = fileno(saveifp);
if (saveofp) {
@@ -263,16 +263,22 @@ int len;
}
fp = saveifp;
}
+#if defined(HAS_FCNTL) && defined(F_SETFD)
+ fd = fileno(fp);
+ fcntl(fd,F_SETFD,fd > maxsysfd);
+#endif
stio->ifp = fp;
if (writing) {
- if (stio->type != 's')
- stio->ofp = fp;
- else
+ if (stio->type == 's'
+ || (stio->type == '>' && S_ISCHR(statbuf.st_mode)) ) {
if (!(stio->ofp = fdopen(fileno(fp),"w"))) {
fclose(fp);
stio->ifp = Nullfp;
goto say_false;
}
+ }
+ else
+ stio->ofp = fp;
}
return TRUE;