Skip to content
Snippets Groups Projects
Commit d6cacfef authored by Timo Sirainen's avatar Timo Sirainen Committed by Stephan Bosch
Browse files

Use i_unlink() to improve unexpected unlink() error messages.

parent 1521447e
No related branches found
No related tags found
No related merge requests found
......@@ -68,9 +68,8 @@ static int seekable_fd_callback
}
/* we just want the fd, unlink it */
if (unlink(str_c(path)) < 0) {
if (i_unlink(str_c(path)) < 0) {
/* shouldn't happen.. */
i_error("unlink(%s) failed: %m", str_c(path));
i_close_fd(&fd);
return -1;
}
......
......@@ -163,7 +163,7 @@ int sieve_file_storage_active_replace_link
if ( ret < 0 ) {
/* Failed; created symlink must be deleted */
(void)unlink(active_path_new);
i_unlink(active_path_new);
sieve_storage_set_critical(storage,
"Performing rename() %s to %s failed: %m",
active_path_new, fstorage->active_path);
......
......@@ -443,14 +443,14 @@ sieve_file_storage_save_to(struct sieve_file_storage *fstorage,
"read(%s) failed: %s", i_stream_get_name(input),
i_stream_get_error(input));
o_stream_destroy(&output);
(void)unlink(str_c(temp_path));
i_unlink(str_c(temp_path));
return -1;
case OSTREAM_SEND_ISTREAM_RESULT_ERROR_OUTPUT:
sieve_storage_set_critical(storage,
"write(%s) failed: %s", str_c(temp_path),
o_stream_get_error(output));
o_stream_destroy(&output);
(void)unlink(str_c(temp_path));
i_unlink(str_c(temp_path));
return -1;
}
o_stream_destroy(&output);
......@@ -468,9 +468,8 @@ sieve_file_storage_save_to(struct sieve_file_storage *fstorage,
"rename(%s, %s) failed: %m",
str_c(temp_path), target);
}
i_unlink(str_c(temp_path));
}
(void)unlink(str_c(temp_path));
return 0;
}
......
......@@ -429,9 +429,8 @@ static int program_client_seekable_fd_callback
}
/* we just want the fd, unlink it */
if (unlink(str_c(path)) < 0) {
if (i_unlink(str_c(path)) < 0) {
/* shouldn't happen.. */
i_error("unlink(%s) failed: %m", str_c(path));
i_close_fd(&fd);
return -1;
}
......
......@@ -398,7 +398,7 @@ int main(int argc, char **argv)
break;
case SIEVE_EXEC_BIN_CORRUPT:
i_info("corrupt binary deleted.");
(void) unlink(sieve_binary_path(sbin));
i_unlink_if_exists(sieve_binary_path(sbin));
/* fall through */
case SIEVE_EXEC_FAILURE:
i_info("final result: failed; resolved with successful implicit keep");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.