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

old-commit-hash: c1edc0901e983c456d53c5dffbd72bd4aebe0419
This commit is contained in:
Dean Lee
2024-04-11 10:51:33 +08:00
committed by GitHub
parent b5ccf4ba02
commit 9e67d3fd70
+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;
}