Skip to content

Commit

Permalink
only unlink if we used g_tmpfile
Browse files Browse the repository at this point in the history
  • Loading branch information
taviso committed Mar 6, 2019
1 parent ecfcca3 commit 50e28dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ gint g_unlinked_tmp(GError **error)
// O_TMPFILE can be defined but still fail on some systems.
if (fd == -1) {
fd = g_file_open_tmp(NULL, &filename, error);
}

if (fd != -1) {
g_unlink(filename);
g_free(filename);
if (fd != -1) {
g_unlink(filename);
g_free(filename);
}
}
return fd;
}
Expand Down

0 comments on commit 50e28dd

Please sign in to comment.