aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io')
-rw-r--r--libgfortran/io/unix.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 4a133fd..ad2577c 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -150,13 +150,21 @@ fallback_access (const char *path, int mode)
{
int fd;
- if ((mode & R_OK) && (fd = open (path, O_RDONLY)) < 0)
- return -1;
- close (fd);
+ if (mode & R_OK)
+ {
+ if ((fd = open (path, O_RDONLY)) < 0)
+ return -1;
+ else
+ close (fd);
+ }
- if ((mode & W_OK) && (fd = open (path, O_WRONLY)) < 0)
- return -1;
- close (fd);
+ if (mode & W_OK)
+ {
+ if ((fd = open (path, O_WRONLY)) < 0)
+ return -1;
+ else
+ close (fd);
+ }
if (mode == F_OK)
{