From 42dfafa935db4f6f368499108307676dbf1317cc Mon Sep 17 00:00:00 2001 From: Janne Blomqvist Date: Thu, 22 Dec 2011 22:44:32 +0200 Subject: PR 51646 Use POSIX mode flags in open() argument. 2011-12-22 Janne Blomqvist Tobias Burnus 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 From-SVN: r182638 --- libgfortran/ChangeLog | 10 ++++++++++ libgfortran/acinclude.m4 | 4 ++-- libgfortran/configure | 4 ++-- 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 + Tobias Burnus + + 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 * 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); -- cgit v1.1