comparison libgfortran/io/close.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Copyright (C) 2002-2018 Free Software Foundation, Inc. 1 /* Copyright (C) 2002-2020 Free Software Foundation, Inc.
2 Contributed by Andy Vaught 2 Contributed by Andy Vaught
3 3
4 This file is part of the GNU Fortran 95 runtime library (libgfortran). 4 This file is part of the GNU Fortran 95 runtime library (libgfortran).
5 5
6 Libgfortran is free software; you can redistribute it and/or modify 6 Libgfortran is free software; you can redistribute it and/or modify
97 generate_warning (&clp->common, "STATUS set to DELETE on CLOSE" 97 generate_warning (&clp->common, "STATUS set to DELETE on CLOSE"
98 " but file protected by READONLY specifier"); 98 " but file protected by READONLY specifier");
99 else 99 else
100 { 100 {
101 #if HAVE_UNLINK_OPEN_FILE 101 #if HAVE_UNLINK_OPEN_FILE
102 remove (u->filename); 102
103 if (remove (u->filename))
104 generate_error (&clp->common, LIBERROR_OS,
105 "File cannot be deleted");
103 #else 106 #else
104 path = strdup (u->filename); 107 path = strdup (u->filename);
105 #endif 108 #endif
106 } 109 }
107 } 110 }
110 close_unit (u); 113 close_unit (u);
111 114
112 #if !HAVE_UNLINK_OPEN_FILE 115 #if !HAVE_UNLINK_OPEN_FILE
113 if (path != NULL) 116 if (path != NULL)
114 { 117 {
115 remove (path); 118 if (remove (path))
119 generate_error (&clp->common, LIBERROR_OS,
120 "File cannot be deleted");
116 free (path); 121 free (path);
117 } 122 }
118 #endif 123 #endif
119 } 124 }
120 125