Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
47dad3ff
Commit
47dad3ff
authored
Aug 01, 2010
by
Janne Blomqvist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use access(2) instead of stat(2) to test file existence.
From-SVN: r162798
parent
22db1fbc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
36 deletions
+48
-36
libgfortran/ChangeLog
+7
-1
libgfortran/io/unix.c
+41
-35
No files found.
libgfortran/ChangeLog
View file @
47dad3ff
2010-08-01 Janne Blomqvist <jb@gcc.gnu.org>
* io/unix.c (file_exists): Use access(2) instead of stat(2) to
test file existence.
(fallback_access): Move up in file, implement F_OK.
2010-07-31 David Edelsohn <edelsohn@gnu.org>
* io/inquire.c: Include io.h before string.h.
...
...
@@ -36,7 +42,7 @@
* write_float.def (output_float): Use a gfc_char4_t pointer and
update memset4 and memcpy calls. (write_infnan): Likewise.
(output_float_FMT_G_): Likewise.
2010-07-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/37077
...
...
libgfortran/io/unix.c
View file @
47dad3ff
...
...
@@ -131,6 +131,46 @@ typedef struct stat gfstat_t;
#endif
#ifndef HAVE_ACCESS
#ifndef W_OK
#define W_OK 2
#endif
#ifndef R_OK
#define R_OK 4
#endif
#ifndef F_OK
#define F_OK 0
#endif
/* Fallback implementation of access() on systems that don't have it.
Only modes R_OK, W_OK and F_OK are used in this file. */
static
int
fallback_access
(
const
char
*
path
,
int
mode
)
{
if
((
mode
&
R_OK
)
&&
open
(
path
,
O_RDONLY
)
<
0
)
return
-
1
;
if
((
mode
&
W_OK
)
&&
open
(
path
,
O_WRONLY
)
<
0
)
return
-
1
;
if
(
mode
==
F_OK
)
{
gfstat_t
st
;
return
stat
(
path
,
&
st
);
}
return
0
;
}
#undef access
#define access fallback_access
#endif
/* Unix and internal stream I/O module */
static
const
int
BUFFER_SIZE
=
8192
;
...
...
@@ -1580,15 +1620,11 @@ int
file_exists
(
const
char
*
file
,
gfc_charlen_type
file_len
)
{
char
path
[
PATH_MAX
+
1
];
gfstat_t
statbuf
;
if
(
unpack_filename
(
path
,
file
,
file_len
))
return
0
;
if
(
stat
(
path
,
&
statbuf
)
<
0
)
return
0
;
return
1
;
return
!
(
access
(
path
,
F_OK
));
}
...
...
@@ -1695,36 +1731,6 @@ inquire_unformatted (const char *string, int len)
}
#ifndef HAVE_ACCESS
#ifndef W_OK
#define W_OK 2
#endif
#ifndef R_OK
#define R_OK 4
#endif
/* Fallback implementation of access() on systems that don't have it.
Only modes R_OK and W_OK are used in this file. */
static
int
fallback_access
(
const
char
*
path
,
int
mode
)
{
if
((
mode
&
R_OK
)
&&
open
(
path
,
O_RDONLY
)
<
0
)
return
-
1
;
if
((
mode
&
W_OK
)
&&
open
(
path
,
O_WRONLY
)
<
0
)
return
-
1
;
return
0
;
}
#undef access
#define access fallback_access
#endif
/* inquire_access()-- Given a fortran string, determine if the file is
* suitable for access. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment