From: Janne Blomqvist Date: Thu, 22 Dec 2011 20:44:32 +0000 (+0200) Subject: PR 51646 Use POSIX mode flags in open() argument. X-Git-Tag: releases/gcc-4.7.0~1337 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=42dfafa935db4f6f368499108307676dbf1317cc;p=thirdparty%2Fgcc.git 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 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 750428fec7a4..f516bad10490 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 b6cb40430afe..645b248deb42 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 6ae1f09f48c1..3ce3d08ae89d 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 f320733e8598..6eef3f99a0a9 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);