commit bcf5a4329785e99de746fcacadcf0530e5889ef3 from: Stefan Sperling via: Thomas Adam date: Sun Oct 16 09:34:56 2022 UTC check for unlink(2) errors in got_opentempfd() ok op@ commit - e6b88e161ad828106984b234e87b11f46df49a53 commit + bcf5a4329785e99de746fcacadcf0530e5889ef3 blob - 26116c3f47dfcdbc7f734406539e46e2cce8a1b4 blob + c65936153fe14c9cfc2a0ca03e30d461c2610e3b --- lib/opentemp.c +++ lib/opentemp.c @@ -36,8 +36,12 @@ got_opentempfd(void) return -1; fd = mkstemp(name); - if (fd != -1) - unlink(name); + if (fd != -1) { + if (unlink(name) == -1) { + close(fd); + return -1; + } + } return fd; }