mirror of git://gcc.gnu.org/git/gcc.git
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. From-SVN: r227472
This commit is contained in:
parent
c8c030589b
commit
43ff5c7a2d
|
|
@ -1,3 +1,8 @@
|
||||||
|
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.
|
||||||
|
|
||||||
2015-09-03 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
|
2015-09-03 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
|
||||||
|
|
||||||
* gcc.target/powerpc/vec-mult-char-1.c: New test.
|
* gcc.target/powerpc/vec-mult-char-1.c: New test.
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,14 @@ program bug
|
||||||
integer ios
|
integer ios
|
||||||
call system('[ -d junko.dir ] || mkdir junko.dir')
|
call system('[ -d junko.dir ] || mkdir junko.dir')
|
||||||
open(unit=10, file='junko.dir',iostat=ios,action='read',access='stream')
|
open(unit=10, file='junko.dir',iostat=ios,action='read',access='stream')
|
||||||
if (ios.ne.0) call abort
|
if (ios.ne.0) then
|
||||||
read(10, iostat=ios) c
|
|
||||||
if (ios.ne.21) then
|
|
||||||
close(10)
|
|
||||||
call system('rmdir junko.dir')
|
call system('rmdir junko.dir')
|
||||||
call abort
|
call abort
|
||||||
end if
|
end if
|
||||||
close(10)
|
read(10, iostat=ios) c
|
||||||
call system('rmdir junko.dir')
|
if (ios.ne.21) then
|
||||||
|
close(10, status='delete')
|
||||||
|
call abort
|
||||||
|
end if
|
||||||
|
close(10, status='delete')
|
||||||
end program bug
|
end program bug
|
||||||
|
|
|
||||||
|
|
@ -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>
|
2015-09-02 Janne Blomqvist <jb@gcc.gnu.org>
|
||||||
|
|
||||||
PR libfortran/67414
|
PR libfortran/67414
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ st_close (st_parameter_close *clp)
|
||||||
if (status == CLOSE_DELETE)
|
if (status == CLOSE_DELETE)
|
||||||
{
|
{
|
||||||
#if HAVE_UNLINK_OPEN_FILE
|
#if HAVE_UNLINK_OPEN_FILE
|
||||||
delete_file (u);
|
remove (u->filename);
|
||||||
#else
|
#else
|
||||||
path = strdup (u->filename);
|
path = strdup (u->filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -92,7 +92,7 @@ st_close (st_parameter_close *clp)
|
||||||
#if !HAVE_UNLINK_OPEN_FILE
|
#if !HAVE_UNLINK_OPEN_FILE
|
||||||
if (path != NULL)
|
if (path != NULL)
|
||||||
{
|
{
|
||||||
unlink (path);
|
remove (path);
|
||||||
free (path);
|
free (path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,7 @@ already_open (st_parameter_open *opp, gfc_unit * u, unit_flags * flags)
|
||||||
|
|
||||||
#if !HAVE_UNLINK_OPEN_FILE
|
#if !HAVE_UNLINK_OPEN_FILE
|
||||||
if (u->filename && u->flags.status == STATUS_SCRATCH)
|
if (u->filename && u->flags.status == STATUS_SCRATCH)
|
||||||
unlink (u->filename);
|
remove (u->filename);
|
||||||
#endif
|
#endif
|
||||||
free (u->filename);
|
free (u->filename);
|
||||||
u->filename = NULL;
|
u->filename = NULL;
|
||||||
|
|
|
||||||
|
|
@ -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
|
/* file_exists()-- Returns nonzero if the current filename exists on
|
||||||
* the system */
|
* the system */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,9 +141,6 @@ internal_proto(compare_file_filename);
|
||||||
extern gfc_unit *find_file (const char *file, gfc_charlen_type file_len);
|
extern gfc_unit *find_file (const char *file, gfc_charlen_type file_len);
|
||||||
internal_proto(find_file);
|
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);
|
extern int file_exists (const char *file, gfc_charlen_type file_len);
|
||||||
internal_proto(file_exists);
|
internal_proto(file_exists);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue