Commit 42dfafa9 by Janne Blomqvist

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
parent bbe847a1
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> 2011-11-21 Andreas Tobler <andreast@fgznet.ch>
* configure: Regenerate. * configure: Regenerate.
......
...@@ -119,7 +119,7 @@ int main () ...@@ -119,7 +119,7 @@ int main ()
{ {
int fd; 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) if (fd <= 0)
return 0; return 0;
if (unlink ("testfile") == -1) if (unlink ("testfile") == -1)
...@@ -127,7 +127,7 @@ int main () ...@@ -127,7 +127,7 @@ int main ()
write (fd, "This is a test\n", 15); write (fd, "This is a test\n", 15);
close (fd); close (fd);
if (open ("testfile", O_RDONLY, S_IWRITE | S_IREAD) == -1 && errno == ENOENT) if (open ("testfile", O_RDONLY) == -1 && errno == ENOENT)
return 0; return 0;
else else
return 1; return 1;
......
...@@ -25598,7 +25598,7 @@ int main () ...@@ -25598,7 +25598,7 @@ int main ()
{ {
int fd; 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) if (fd <= 0)
return 0; return 0;
if (unlink ("testfile") == -1) if (unlink ("testfile") == -1)
...@@ -25606,7 +25606,7 @@ int main () ...@@ -25606,7 +25606,7 @@ int main ()
write (fd, "This is a test\n", 15); write (fd, "This is a test\n", 15);
close (fd); close (fd);
if (open ("testfile", O_RDONLY, S_IWRITE | S_IREAD) == -1 && errno == ENOENT) if (open ("testfile", O_RDONLY) == -1 && errno == ENOENT)
return 0; return 0;
else else
return 1; return 1;
......
...@@ -1112,9 +1112,9 @@ tempfile (st_parameter_open *opp) ...@@ -1112,9 +1112,9 @@ tempfile (st_parameter_open *opp)
#if defined(HAVE_CRLF) && defined(O_BINARY) #if defined(HAVE_CRLF) && defined(O_BINARY)
fd = open (template, O_RDWR | O_CREAT | O_EXCL | O_BINARY, fd = open (template, O_RDWR | O_CREAT | O_EXCL | O_BINARY,
S_IREAD | S_IWRITE); S_IRUSR | S_IWUSR);
#else #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 #endif
} }
while (fd == -1 && errno == EEXIST); while (fd == -1 && errno == EEXIST);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment