common/params.cc: unlink tmp_path only if there's an error (#32145)

This commit is contained in:
Dean Lee
2024-04-11 10:51:33 +08:00
committed by GitHub
parent 9d1b3cc773
commit c1edc0901e
+3 -1
View File
@@ -273,7 +273,9 @@ int Params::put(const char* key, const char* value, size_t value_size) {
} while (false);
close(tmp_fd);
::unlink(tmp_path.c_str());
if (result != 0) {
::unlink(tmp_path.c_str());
}
return result;
}