dovecot-2.2: Use the new [io]_stream_create_fd_*autoclose() func...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jun 12 23:20:49 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/b67c1c9bf1a5
changeset: 17480:b67c1c9bf1a5
user: Timo Sirainen <tss at iki.fi>
date: Fri Jun 13 02:19:15 2014 +0300
description:
Use the new [io]_stream_create_fd_*autoclose() functions wherever possible.
diffstat:
src/auth/mech-winbind.c | 4 ++--
src/auth/userdb-passwd-file.c | 2 +-
src/config/config-parser.c | 4 ++--
src/doveadm/doveadm-director.c | 4 ++--
src/doveadm/doveadm-dump-dbox.c | 2 +-
src/doveadm/doveadm-log.c | 4 ++--
src/doveadm/doveadm-penalty.c | 4 ++--
src/doveadm/doveadm-replicator.c | 2 +-
src/doveadm/doveadm-stats.c | 4 ++--
src/doveadm/doveadm-who.c | 4 ++--
src/doveadm/doveadm-zlib.c | 2 +-
src/lib-compression/test-compression.c | 2 +-
src/lib-imap-urlauth/imap-urlauth-connection.c | 4 ++--
src/lib-lda/smtp-client.c | 4 ++--
src/lib-master/master-instance.c | 2 +-
src/lib-master/mountpoint-list.c | 2 +-
src/lib-settings/settings-parser.c | 4 ++--
src/lib-settings/settings.c | 4 ++--
src/lib-storage/index/cydir/cydir-mail.c | 2 +-
src/lib-storage/index/dbox-common/dbox-file.c | 7 +++++--
src/lib-storage/index/imapc/imapc-save.c | 3 +--
src/lib-storage/index/maildir/maildir-mail.c | 2 +-
src/lib-storage/index/raw/raw-storage.c | 2 +-
src/lib-storage/list/subscription-file.c | 12 +++++-------
src/lib/iostream-temp.c | 8 ++++----
src/lib/istream-seekable.c | 2 +-
src/plugins/fts/fts-parser-script.c | 2 +-
src/plugins/zlib/zlib-plugin.c | 2 +-
src/replication/replicator/replicator-queue.c | 4 ++--
src/ssl-params/main.c | 2 +-
src/util/rawlog.c | 4 ++--
31 files changed, 55 insertions(+), 55 deletions(-)
diffs (truncated from 515 to 300 lines):
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/auth/mech-winbind.c
--- a/src/auth/mech-winbind.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/auth/mech-winbind.c Fri Jun 13 02:19:15 2014 +0300
@@ -146,9 +146,9 @@
winbind->pid = pid;
winbind->in_pipe =
- i_stream_create_fd(infd[0], AUTH_CLIENT_MAX_LINE_LENGTH, TRUE);
+ i_stream_create_fd_autoclose(&infd[0], AUTH_CLIENT_MAX_LINE_LENGTH);
winbind->out_pipe =
- o_stream_create_fd(outfd[1], (size_t)-1, TRUE);
+ o_stream_create_fd_autoclose(&outfd[1], (size_t)-1);
if (!sigchld_handler_set) {
sigchld_handler_set = TRUE;
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/auth/userdb-passwd-file.c
--- a/src/auth/userdb-passwd-file.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/auth/userdb-passwd-file.c Fri Jun 13 02:19:15 2014 +0300
@@ -115,7 +115,7 @@
i_error("open(%s) failed: %m", ctx->path);
ctx->ctx.failed = TRUE;
} else {
- ctx->input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ ctx->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
}
return &ctx->ctx;
}
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/config/config-parser.c
--- a/src/config/config-parser.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/config/config-parser.c Fri Jun 13 02:19:15 2014 +0300
@@ -476,7 +476,7 @@
new_input = p_new(ctx->pool, struct input_stack, 1);
new_input->prev = ctx->cur_input;
new_input->path = p_strdup(ctx->pool, path);
- new_input->input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ new_input->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
i_stream_set_return_partial_line(new_input->input, TRUE);
ctx->cur_input = new_input;
return 0;
@@ -936,7 +936,7 @@
ctx.str = str_new(ctx.pool, 256);
full_line = str_new(default_pool, 512);
ctx.cur_input->input = fd != -1 ?
- i_stream_create_fd(fd, (size_t)-1, TRUE) :
+ i_stream_create_fd_autoclose(&fd, (size_t)-1) :
i_stream_create_from_data("", 0);
i_stream_set_return_partial_line(ctx.cur_input->input, TRUE);
old_settings_init(&ctx);
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/doveadm/doveadm-director.c
--- a/src/doveadm/doveadm-director.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/doveadm/doveadm-director.c Fri Jun 13 02:19:15 2014 +0300
@@ -53,7 +53,7 @@
fd = doveadm_connect(ctx->socket_path);
net_set_nonblock(fd, FALSE);
- ctx->input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ ctx->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
director_send(ctx, DIRECTOR_HANDSHAKE);
alarm(5);
@@ -243,7 +243,7 @@
fd = open(path, O_RDONLY);
if (fd == -1)
i_fatal("open(%s) failed: %m", path);
- input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
while ((username = i_stream_read_next_line(input)) != NULL)
user_list_add(username, pool, users);
i_stream_unref(&input);
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/doveadm/doveadm-dump-dbox.c
--- a/src/doveadm/doveadm-dump-dbox.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/doveadm/doveadm-dump-dbox.c Fri Jun 13 02:19:15 2014 +0300
@@ -200,7 +200,7 @@
if (fd < 0)
i_fatal("open(%s) failed: %m", argv[1]);
- input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
i_stream_set_name(input, argv[1]);
hdr_size = dump_file_hdr(input);
do {
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/doveadm/doveadm-log.c
--- a/src/doveadm/doveadm-log.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/doveadm/doveadm-log.c Fri Jun 13 02:19:15 2014 +0300
@@ -153,7 +153,7 @@
if (fd == -1)
return;
- input = i_stream_create_fd(fd, 1024, TRUE);
+ input = i_stream_create_fd_autoclose(&fd, 1024);
i_stream_seek(input, file->size);
while ((line = i_stream_read_next_line(input)) != NULL) {
p = strstr(line, TEST_LOG_MSG_PREFIX);
@@ -331,7 +331,7 @@
i_fatal("net_connect_unix(%s) failed: %m", path);
net_set_nonblock(fd, FALSE);
- input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
while ((line = i_stream_read_next_line(input)) != NULL) T_BEGIN {
args = t_strsplit_tabescaped(line);
if (str_array_length(args) == 4)
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/doveadm/doveadm-penalty.c
--- a/src/doveadm/doveadm-penalty.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/doveadm/doveadm-penalty.c Fri Jun 13 02:19:15 2014 +0300
@@ -70,10 +70,10 @@
fd = doveadm_connect(ctx->anvil_path);
net_set_nonblock(fd, FALSE);
-
- input = i_stream_create_fd(fd, (size_t)-1, TRUE);
if (write(fd, ANVIL_CMD, strlen(ANVIL_CMD)) < 0)
i_fatal("write(%s) failed: %m", ctx->anvil_path);
+
+ input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
while ((line = i_stream_read_next_line(input)) != NULL) {
if (*line == '\0')
break;
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/doveadm/doveadm-replicator.c
--- a/src/doveadm/doveadm-replicator.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/doveadm/doveadm-replicator.c Fri Jun 13 02:19:15 2014 +0300
@@ -42,7 +42,7 @@
fd = doveadm_connect(ctx->socket_path);
net_set_nonblock(fd, FALSE);
- ctx->input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ ctx->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
replicator_send(ctx, REPLICATOR_HANDSHAKE);
alarm(5);
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/doveadm/doveadm-stats.c
--- a/src/doveadm/doveadm-stats.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/doveadm/doveadm-stats.c Fri Jun 13 02:19:15 2014 +0300
@@ -83,11 +83,11 @@
fd = doveadm_connect(path);
net_set_nonblock(fd, FALSE);
-
- input = i_stream_create_fd(fd, (size_t)-1, TRUE);
if (write_full(fd, cmd, strlen(cmd)) < 0)
i_fatal("write(%s) failed: %m", path);
+ input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+
/* read header */
args = read_next_line(input);
if (args == NULL)
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/doveadm/doveadm-who.c
--- a/src/doveadm/doveadm-who.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/doveadm/doveadm-who.c Fri Jun 13 02:19:15 2014 +0300
@@ -139,10 +139,10 @@
fd = doveadm_connect(ctx->anvil_path);
net_set_nonblock(fd, FALSE);
-
- input = i_stream_create_fd(fd, (size_t)-1, TRUE);
if (write(fd, ANVIL_CMD, strlen(ANVIL_CMD)) < 0)
i_fatal("write(%s) failed: %m", ctx->anvil_path);
+
+ input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
while ((line = i_stream_read_next_line(input)) != NULL) {
if (*line == '\0')
break;
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/doveadm/doveadm-zlib.c
--- a/src/doveadm/doveadm-zlib.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/doveadm/doveadm-zlib.c Fri Jun 13 02:19:15 2014 +0300
@@ -52,7 +52,7 @@
fd = open(argv[1], O_RDONLY);
if (fd < 0)
i_fatal("open(%s) failed: %m", argv[1]);
- input = i_stream_create_fd(fd, 1024*32, TRUE);
+ input = i_stream_create_fd_autoclose(&fd, 1024*32);
while ((line = i_stream_read_next_line(input)) != NULL) {
/* skip tag */
printf("%s\r\n", line);
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/lib-compression/test-compression.c
--- a/src/lib-compression/test-compression.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/lib-compression/test-compression.c Fri Jun 13 02:19:15 2014 +0300
@@ -125,7 +125,7 @@
sha1_init(&sha1);
file_output = o_stream_create_fd_file(fd_out, 0, FALSE);
output = handler->create_ostream(file_output, 1);
- input = i_stream_create_fd(fd_in, IO_BLOCK_SIZE, TRUE);
+ input = i_stream_create_fd_autoclose(&fd_in, IO_BLOCK_SIZE);
while (i_stream_read_data(input, &data, &size, 0) > 0) {
sha1_loop(&sha1, data, size);
o_stream_nsend(output, data, size);
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/lib-imap-urlauth/imap-urlauth-connection.c
--- a/src/lib-imap-urlauth/imap-urlauth-connection.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/lib-imap-urlauth/imap-urlauth-connection.c Fri Jun 13 02:19:15 2014 +0300
@@ -607,8 +607,8 @@
uoff_t fd_size;
if (conn->literal_fd != -1) {
- reply->input = i_stream_create_fd(conn->literal_fd,
- (size_t)-1, TRUE);
+ reply->input = i_stream_create_fd_autoclose(&conn->literal_fd,
+ (size_t)-1);
if (i_stream_get_size(reply->input, TRUE, &fd_size) < 1 ||
fd_size != conn->literal_size) {
i_stream_unref(&reply->input);
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/lib-lda/smtp-client.c
--- a/src/lib-lda/smtp-client.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/lib-lda/smtp-client.c Fri Jun 13 02:19:15 2014 +0300
@@ -144,7 +144,7 @@
}
i_close_fd(&fd[0]);
- client->output = o_stream_create_fd(fd[1], IO_BLOCK_SIZE, TRUE);
+ client->output = o_stream_create_fd_autoclose(&fd[1], IO_BLOCK_SIZE);
o_stream_set_no_error_handling(client->output, TRUE);
client->pid = pid;
return client->output;
@@ -164,7 +164,7 @@
return o_stream_create_error(errno);
client->temp_path = i_strdup(path);
client->temp_fd = fd;
- client->output = o_stream_create_fd(fd, IO_BLOCK_SIZE, TRUE);
+ client->output = o_stream_create_fd_autoclose(&fd, IO_BLOCK_SIZE);
o_stream_set_no_error_handling(client->output, TRUE);
return client->output;
}
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/lib-master/master-instance.c
--- a/src/lib-master/master-instance.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/lib-master/master-instance.c Fri Jun 13 02:19:15 2014 +0300
@@ -110,7 +110,7 @@
i_error("open(%s) failed: %m", list->path);
return -1;
}
- input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
while ((line = i_stream_read_next_line(input)) != NULL) T_BEGIN {
if (master_instance_list_add_line(list, line) < 0)
i_error("Invalid line in %s: %s", list->path, line);
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/lib-master/mountpoint-list.c
--- a/src/lib-master/mountpoint-list.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/lib-master/mountpoint-list.c Fri Jun 13 02:19:15 2014 +0300
@@ -138,7 +138,7 @@
}
if (fstat(fd, &list->load_st) < 0)
i_error("fstat(%s) failed: %m", list->state_path);
- input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
while ((line = i_stream_read_next_line(input)) != NULL) {
p = strchr(line, ' ');
if (p == NULL) {
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/lib-settings/settings-parser.c Fri Jun 13 02:19:15 2014 +0300
@@ -999,7 +999,7 @@
return -1;
}
- input = i_stream_create_fd(fd, max_line_length, TRUE);
+ input = i_stream_create_fd_autoclose(&fd, max_line_length);
i_stream_set_name(input, path);
ret = settings_parse_stream_read(ctx, input);
i_stream_unref(&input);
@@ -1089,7 +1089,7 @@
}
i_close_fd(&fd[1]);
- input = i_stream_create_fd(fd[0], (size_t)-1, TRUE);
+ input = i_stream_create_fd_autoclose(&fd[0], (size_t)-1);
i_stream_set_name(input, bin_path);
ret = settings_parse_stream_read(ctx, input);
i_stream_destroy(&input);
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/lib-settings/settings.c
--- a/src/lib-settings/settings.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/lib-settings/settings.c Fri Jun 13 02:19:15 2014 +0300
@@ -119,7 +119,7 @@
new_input = t_new(struct input_stack, 1);
new_input->prev = *inputp;
new_input->path = t_strdup(path);
- new_input->input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ new_input->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
i_stream_set_return_partial_line(new_input->input, TRUE);
*inputp = new_input;
return 0;
@@ -201,7 +201,7 @@
full_line = t_str_new(512);
sections = 0; root_section = 0; errormsg = NULL;
- input->input = i_stream_create_fd(fd, (size_t)-1, TRUE);
+ input->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
i_stream_set_return_partial_line(input->input, TRUE);
prevfile:
while ((line = i_stream_read_next_line(input->input)) != NULL) {
diff -r 0bcb43692d91 -r b67c1c9bf1a5 src/lib-storage/index/cydir/cydir-mail.c
--- a/src/lib-storage/index/cydir/cydir-mail.c Fri Jun 13 02:18:53 2014 +0300
+++ b/src/lib-storage/index/cydir/cydir-mail.c Fri Jun 13 02:19:15 2014 +0300
@@ -115,7 +115,7 @@
}
return -1;
}
- input = i_stream_create_fd(fd, 0, TRUE);
+ input = i_stream_create_fd_autoclose(&fd, 0);
i_stream_set_name(input, path);
index_mail_set_read_buffer_size(_mail, input);
if (mail->mail.v.istream_opened != NULL) {
More information about the dovecot-cvs
mailing list