Skip to content

Commit ae1f0dd

Browse files
authored
g.mapset: Fix unchecked return value when removing lock (OSGeo#6498)
Check previously unchecked return value from remove C library function
1 parent 9278c30 commit ae1f0dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

general/g.mapset/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*
1818
**************************************************************/
1919

20+
#include <errno.h>
2021
#include <stdlib.h>
2122
#include <stdio.h>
2223
#include <string.h>
@@ -279,7 +280,10 @@ int main(int argc, char *argv[])
279280

280281
/* Remove old lock */
281282
snprintf(path, sizeof(path), "%s/.gislock", mapset_old_path);
282-
remove(path);
283+
if (remove(path) != 0) {
284+
G_warning(_("Failed to remove old lock file <%s>: %s"), path,
285+
strerror(errno));
286+
}
283287

284288
G_free(mapset_old_path);
285289

0 commit comments

Comments
 (0)