fix possible file descriptor leak if fprintf() fails

This commit is contained in:
peter15914 2025-01-05 18:16:52 +05:00
parent 2e9f23a2f4
commit c1c9af3ead

View File

@ -963,6 +963,7 @@ void write_pid_file(const char* pidfile)
res = fprintf(f, "%d\n", getpid());
if (res < 0) {
print_message(msg_system_error, "write_pid_file: fprintf: %s\n", strerror(errno));
fclose(f);
return;
}