develooper Front page | perl.perl5.porters | Postings from June 2001

[ID 20010625.009] open(FILE,"+foo") [PATCH]

Thread Next
From:
Robert Spier
Date:
June 27, 2001 20:13
Subject:
[ID 20010625.009] open(FILE,"+foo") [PATCH]
Message ID:
15162.41164.618712.841415@rls.cx

patch against @10929

in C<open(FOO,"+foo")> the + would be interpreted as part of the
implicit open for reading, making it open for read/write.  (i.e. +<)

This patch removes that icky behaviour.  If you want +<, you need to
specify it.  As a plus, perl can now open files starting with +.

the *(type+1) should be safe, because type should be a null terminated
string, and hopefully the compiler will be smart and optimize away the
double dereference. 


--- doio.c.orig Tue Jun 26 01:14:30 2001
+++ doio.c      Wed Jun 27 23:02:51 2001
@@ -233,6 +233,7 @@
        }
        IoTYPE(io) = *type;
        if ((*type == IoTYPE_RDWR) && /* scary */
+           (*(type+1) == IoTYPE_RDONLY || *(type+1) == IoTYPE_WRONLY) &&
            ((!num_svs || (tend > type+1 && tend[-1] != IoTYPE_PIPE)))) {
            mode[1] = *type++;
            writing = 1;





Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About