Skip to content

Commit 4883264

Browse files
authored
r.thin: Fix argument cannot be negative issue in io.c (OSGeo#6507)
1 parent d4a9428 commit 4883264

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

raster/r.thin/io.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ int open_file(char *name)
118118
work_file_name = G_tempfile();
119119

120120
/* create the file and then open it for read and write */
121-
close(creat(work_file_name, 0666));
121+
int tmpfd = creat(work_file_name, 0666);
122+
if (tmpfd < 0) {
123+
G_fatal_error(_("Unable to create temporary file <%s>"),
124+
work_file_name);
125+
}
126+
close(tmpfd);
122127
if ((work_file = open(work_file_name, 2)) < 0) {
123128
unlink(work_file_name);
124129
G_fatal_error(_("Unable to create temporary file <%s> -- errno = %d"),

0 commit comments

Comments
 (0)