Skip to content
Snippets Groups Projects
Commit 11338868 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Slightly improved error messages during binary save.

parent b6f0a3a1
No related branches found
No related tags found
No related merge requests found
......@@ -647,25 +647,28 @@ bool sieve_binary_save
fd = safe_mkstemp_hostpid(temp_path, save_mode, (uid_t)-1, (gid_t)-1);
if ( fd < 0 ) {
if ( errno == EACCES ) {
sieve_sys_error("failed to save binary: %s",
sieve_sys_error("failed to save binary temporary file: %s",
eacces_error_get_creating("open", str_c(temp_path)));
} else {
sieve_sys_error("failed to save binary: open(%s) failed: %m",
str_c(temp_path));
sieve_sys_error("failed to save binary temporary file: "
"open(%s) failed: %m", str_c(temp_path));
}
return FALSE;
}
/* Save binary */
stream = o_stream_create_fd(fd, 0, FALSE);
result = _sieve_binary_save(sbin, stream);
o_stream_destroy(&stream);
if (close(fd) < 0)
/* Close saved binary */
if ( close(fd) < 0 ) {
sieve_sys_error("failed to close saved binary temporary file: "
"close(fd=%s) failed: %m", str_c(temp_path));
}
/* Replace any original binary atomically */
if (result && (rename(str_c(temp_path), path) < 0)) {
if ( result && (rename(str_c(temp_path), path) < 0) ) {
if ( errno == EACCES ) {
sieve_sys_error("failed to replace existing binary: %s",
eacces_error_get_creating("rename", path));
......
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.