Stop trying to remove NULL filenames on shutdown

Fixes bug 24762; bugfix on master.
(Not in any released version of Tor.)
This commit is contained in:
teor 2017-12-29 23:00:57 +11:00
parent f5d89fab25
commit d99ccf090f
No known key found for this signature in database
GPG Key ID: 740D9E39025272A2
2 changed files with 5 additions and 2 deletions

3
changes/bug24762 Normal file
View File

@ -0,0 +1,3 @@
o Minor bugfixes (shutdown, file handling):
- Stop trying to remove NULL filenames on shutdown.
Fixes bug 24762; bugfix on master.

View File

@ -3480,12 +3480,12 @@ tor_free_all(int postfork)
/** /**
* Remove the specified file, and log a warning if the operation fails for * Remove the specified file, and log a warning if the operation fails for
* any reason other than the file not existing. * any reason other than the file not existing. Ignores NULL filenames.
*/ */
void void
tor_remove_file(const char *filename) tor_remove_file(const char *filename)
{ {
if (tor_unlink(filename) != 0 && errno != ENOENT) { if (filename && tor_unlink(filename) != 0 && errno != ENOENT) {
log_warn(LD_FS, "Couldn't unlink %s: %s", log_warn(LD_FS, "Couldn't unlink %s: %s",
filename, strerror(errno)); filename, strerror(errno));
} }