void-packages/srcpkgs/ckmame/patches/use-mkstemp.patch

25 lines
484 B
Diff

--- a/src/archive_dir.c 2018-12-18 12:11:40.000000000 +0100
+++ b/src/archive_dir.c 2020-02-27 19:36:16.564802868 +0100
@@ -307,6 +307,7 @@
make_tmp_name(archive_t *a, const char *name) {
size_t i, len;
char *s;
+ int fd;
if (a == NULL || name == NULL) {
errno = EINVAL;
@@ -324,10 +325,12 @@
s[i] = '_';
}
- if (mktemp(s) == NULL) {
+ fd = mkstemp(s);
+ if (fd < 0) {
free(s);
return NULL;
}
+ close(fd);
return s;
}