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

Use the new [io]_stream_create_fd_*autoclose() functions wherever possible.

Parallel to identical Dovecot change.
parent 7b7a9e09
No related branches found
No related tags found
No related merge requests found
......@@ -515,7 +515,7 @@ struct ostream *sieve_tool_open_output_stream(const char *filename)
i_fatal("failed to open file for writing: %m");
}
outstream = o_stream_create_fd(fd, 0, TRUE);
outstream = o_stream_create_fd_autoclose(&fd, 0);
}
return outstream;
......
......@@ -286,14 +286,14 @@ static int sieve_file_script_get_stream
*error_r = SIEVE_ERROR_TEMP_FAILURE;
result = NULL;
} else {
result = i_stream_create_fd(fd, SIEVE_FILE_READ_BLOCK_SIZE, TRUE);
result = i_stream_create_fd_autoclose(&fd, SIEVE_FILE_READ_BLOCK_SIZE);
script->st = script->lnk_st = st;
}
}
if ( result == NULL ) {
/* Something went wrong, close the fd */
if ( close(fd) != 0 ) {
if ( fd >= 0 && close(fd) != 0 ) {
sieve_sys_error(svinst,
"failed to close sieve script: close(fd=%s) failed: %m", script->path);
}
......
......@@ -89,8 +89,6 @@ struct sieve_file_script {
const char *filename;
const char *binpath;
const char *binprefix;
int fd;
};
extern const struct sieve_script sieve_file_script;
......
......@@ -95,7 +95,7 @@ void *testsuite_smtp_start
smtp->msg_file);
}
smtp->output = o_stream_create_fd(fd, (size_t)-1, TRUE);
smtp->output = o_stream_create_fd_autoclose(&fd, (size_t)-1);
return (void *) smtp;
}
......
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.