diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2011-12-22 22:44:32 +0200 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2011-12-22 22:44:32 +0200 |
commit | 42dfafa935db4f6f368499108307676dbf1317cc (patch) | |
tree | b51c2b0e0174c8fedc4a4c39e1f7692f16814598 | |
parent | bbe847a162d99872542c9574301b2bfc19c6b365 (diff) | |
download | gcc-42dfafa935db4f6f368499108307676dbf1317cc.zip gcc-42dfafa935db4f6f368499108307676dbf1317cc.tar.gz gcc-42dfafa935db4f6f368499108307676dbf1317cc.tar.bz2 |
PR 51646 Use POSIX mode flags in open() argument.
2011-12-22 Janne Blomqvist <jb@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR libfortran/51646
* acinclude.m4 (LIBGFOR_CHECK_UNLINK_OPEN_FILE): Use POSIX mode
flags, omit mode argument when flags argument does not have
O_CREAT.
* io/unix.c (tempfile): Use POSIX mode flags.
* configure: Regenerate.
Co-Authored-By: Tobias Burnus <burnus@net-b.de>
From-SVN: r182638
-rw-r--r-- | libgfortran/ChangeLog | 10 | ||||
-rw-r--r-- | libgfortran/acinclude.m4 | 4 | ||||
-rwxr-xr-x | libgfortran/configure | 4 | ||||
-rw-r--r-- | libgfortran/io/unix.c | 4 |
4 files changed, 16 insertions, 6 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 750428f..f516bad 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,13 @@ +2011-12-22 Janne Blomqvist <jb@gcc.gnu.org> + Tobias Burnus <burnus@net-b.de> + + PR libfortran/51646 + * acinclude.m4 (LIBGFOR_CHECK_UNLINK_OPEN_FILE): Use POSIX mode + flags, omit mode argument when flags argument does not have + O_CREAT. + * io/unix.c (tempfile): Use POSIX mode flags. + * configure: Regenerate. + 2011-11-21 Andreas Tobler <andreast@fgznet.ch> * configure: Regenerate. diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4 index b6cb404..645b248 100644 --- a/libgfortran/acinclude.m4 +++ b/libgfortran/acinclude.m4 @@ -119,7 +119,7 @@ int main () { int fd; - fd = open ("testfile", O_RDWR | O_CREAT, S_IWRITE | S_IREAD); + fd = open ("testfile", O_RDWR | O_CREAT, S_IWUSR | S_IRUSR); if (fd <= 0) return 0; if (unlink ("testfile") == -1) @@ -127,7 +127,7 @@ int main () write (fd, "This is a test\n", 15); close (fd); - if (open ("testfile", O_RDONLY, S_IWRITE | S_IREAD) == -1 && errno == ENOENT) + if (open ("testfile", O_RDONLY) == -1 && errno == ENOENT) return 0; else return 1; diff --git a/libgfortran/configure b/libgfortran/configure index 6ae1f09..3ce3d08 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -25598,7 +25598,7 @@ int main () { int fd; - fd = open ("testfile", O_RDWR | O_CREAT, S_IWRITE | S_IREAD); + fd = open ("testfile", O_RDWR | O_CREAT, S_IWUSR | S_IRUSR); if (fd <= 0) return 0; if (unlink ("testfile") == -1) @@ -25606,7 +25606,7 @@ int main () write (fd, "This is a test\n", 15); close (fd); - if (open ("testfile", O_RDONLY, S_IWRITE | S_IREAD) == -1 && errno == ENOENT) + if (open ("testfile", O_RDONLY) == -1 && errno == ENOENT) return 0; else return 1; diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index f320733..6eef3f9 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -1112,9 +1112,9 @@ tempfile (st_parameter_open *opp) #if defined(HAVE_CRLF) && defined(O_BINARY) fd = open (template, O_RDWR | O_CREAT | O_EXCL | O_BINARY, - S_IREAD | S_IWRITE); + S_IRUSR | S_IWUSR); #else - fd = open (template, O_RDWR | O_CREAT | O_EXCL, S_IREAD | S_IWRITE); + fd = open (template, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); #endif } while (fd == -1 && errno == EEXIST); |