Skip to content

Commit

Permalink
common/params.cc: unlink tmp_path only if there's an error (commaai#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee authored Apr 11, 2024
1 parent 9d1b3cc commit c1edc09
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit c1edc09

Please sign in to comment.