diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-03 21:18:56 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-03 21:18:56 +0000 |
commit | eb3e44d24587ef5ac02b8a76c28549468536b699 (patch) | |
tree | 593d7f86e1d9512136f291a704411e7af2722593 /libgfortran | |
parent | 09618b06dd971ede9b7bd892c3b6c7193fd52872 (diff) | |
download | gcc-eb3e44d24587ef5ac02b8a76c28549468536b699.tar.gz |
libgfortran: Use remove(3) instead of unlink(2) when deleting files.
testsuite:
2015-09-04 Janne Blomqvist <jb@gcc.gnu.org>
* gfortran.dg/read_dir.f90: Delete empty directory when closing
rather than calling rmdir, cleanup if open fails.
libgfortran:
2015-09-04 Janne Blomqvist <jb@gcc.gnu.org>
* io/unix.h (delete_file): Remove prototype.
* io/unix.c (delete_file): Remove function.
* io/close.c (st_close): Replace delete_file and unlink with
remove.
* io/open.c (already_open): Replace unlink with remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227472 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 8 | ||||
-rw-r--r-- | libgfortran/io/close.c | 4 | ||||
-rw-r--r-- | libgfortran/io/open.c | 2 | ||||
-rw-r--r-- | libgfortran/io/unix.c | 10 | ||||
-rw-r--r-- | libgfortran/io/unix.h | 3 |
5 files changed, 11 insertions, 16 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 0958ca76863..5da6ea32fd6 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,11 @@ +2015-09-04 Janne Blomqvist <jb@gcc.gnu.org> + + * io/unix.h (delete_file): Remove prototype. + * io/unix.c (delete_file): Remove function. + * io/close.c (st_close): Replace delete_file and unlink with + remove. + * io/open.c (already_open): Replace unlink with remove. + 2015-09-02 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/67414 diff --git a/libgfortran/io/close.c b/libgfortran/io/close.c index 38855ee9832..1e109933397 100644 --- a/libgfortran/io/close.c +++ b/libgfortran/io/close.c @@ -80,7 +80,7 @@ st_close (st_parameter_close *clp) if (status == CLOSE_DELETE) { #if HAVE_UNLINK_OPEN_FILE - delete_file (u); + remove (u->filename); #else path = strdup (u->filename); #endif @@ -92,7 +92,7 @@ st_close (st_parameter_close *clp) #if !HAVE_UNLINK_OPEN_FILE if (path != NULL) { - unlink (path); + remove (path); free (path); } #endif diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index 4654de27bd1..630bca6f8d0 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -664,7 +664,7 @@ already_open (st_parameter_open *opp, gfc_unit * u, unit_flags * flags) #if !HAVE_UNLINK_OPEN_FILE if (u->filename && u->flags.status == STATUS_SCRATCH) - unlink (u->filename); + remove (u->filename); #endif free (u->filename); u->filename = NULL; diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index fd5f2779021..5385d8b7700 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -1716,16 +1716,6 @@ flush_all_units (void) } -/* delete_file()-- Given a unit structure, delete the file associated - * with the unit. Returns nonzero if something went wrong. */ - -int -delete_file (gfc_unit * u) -{ - return unlink (u->filename); -} - - /* file_exists()-- Returns nonzero if the current filename exists on * the system */ diff --git a/libgfortran/io/unix.h b/libgfortran/io/unix.h index 78a41f79f4b..d1aa75dbf4e 100644 --- a/libgfortran/io/unix.h +++ b/libgfortran/io/unix.h @@ -141,9 +141,6 @@ internal_proto(compare_file_filename); extern gfc_unit *find_file (const char *file, gfc_charlen_type file_len); internal_proto(find_file); -extern int delete_file (gfc_unit *); -internal_proto(delete_file); - extern int file_exists (const char *file, gfc_charlen_type file_len); internal_proto(file_exists); |