}
if (ctx->io_err != NULL)
io_remove(&ctx->io_err);
- if (ctx->fd_err != -1)
- i_close_fd(&ctx->fd_err);
+ i_close_fd(&ctx->fd_err);
if (ctx->child_wait != NULL)
child_wait_free(&ctx->child_wait);
array_foreach_modifiable(&client->notifys, notify) {
if (notify->io != NULL)
io_remove(¬ify->io);
- if (notify->fd != -1)
- i_close_fd(¬ify->fd);
+ i_close_fd(¬ify->fd);
}
}
if (ret < 0) {
if (client->imap_client != NULL)
imap_client_destroy(&client->imap_client, NULL);
- if (fd != -1)
- i_close_fd(&fd);
+ i_close_fd(&fd);
return -1;
} else if (ret == 0) {
/* still need to read another fd */
if (imap_hibernate_process_send(client, state, fd_notify, &fd_hibernate) < 0)
ret = -1;
}
- if (fd_notify != -1)
- i_close_fd(&fd_notify);
+ i_close_fd(&fd_notify);
if (ret > 0) {
/* hide the disconnect log message, because the client didn't
actually log out */
file_lock_free(&lock);
}
- if (dict->fd != -1)
- i_close_fd(&dict->fd);
+ i_close_fd(&dict->fd);
dict->fd = fd;
return 0;
}
ioloop = io_loop_create();
server_test(i);
io_loop_destroy(&ioloop);
- if (fd_listen != -1)
- i_close_fd(&fd_listen);
+ i_close_fd(&fd_listen);
i_free(bind_ports);
i_free(server_pids);
/* wait for it to be killed; this way, valgrind will not
sleep(60);
exit(1);
}
- if (fd_listen != -1)
- i_close_fd(&fd_listen);
+ i_close_fd(&fd_listen);
}
if (debug)
i_debug("client: PID=%s", my_pid);
ioloop = io_loop_create();
dns_test();
io_loop_destroy(&ioloop);
- if (fd_listen != -1)
- i_close_fd(&fd_listen);
+ i_close_fd(&fd_listen);
/* wait for it to be killed; this way, valgrind will not
object to this process going away inelegantly. */
sleep(60);
exit(1);
}
- if (fd_listen != -1)
- i_close_fd(&fd_listen);
+ i_close_fd(&fd_listen);
}
/* parent: client */
static void test_open_server_fd(void)
{
- if (fd_listen != -1)
- i_close_fd(&fd_listen);
+ i_close_fd(&fd_listen);
fd_listen = net_listen(&bind_ip, &bind_port, 128);
if (fd_listen == -1) {
i_fatal("listen(%s:%u) failed: %m",
i_stream_unref(&server->input);
if (server->output != NULL)
o_stream_unref(&server->output);
- if (server->fd != -1)
- i_close_fd(&server->fd);
+ i_close_fd(&server->fd);
}
static void test_server_disconnect_and_wait(bool send_banner)
imapc_client_deinit(&imapc_client);
io_loop_destroy(&ioloop);
- if (server.fd_listen != -1)
- i_close_fd(&server.fd_listen);
+ i_close_fd(&server.fd_listen);
test_server_kill();
if (unlink_directory(client_set->temp_path_prefix,
UNLINK_DIRECTORY_FLAG_RMDIR, &error) < 0)
if (part->temp_output != NULL)
o_stream_destroy(&part->temp_output);
- if (part->temp_fd != -1)
- i_close_fd(&part->temp_fd);
+ i_close_fd(&part->temp_fd);
i_free_and_null(part->content_type);
i_free_and_null(part->content_disposition);
{
struct temp_ostream *tstream = (struct temp_ostream *)stream;
- if (tstream->fd != -1)
- i_close_fd(&tstream->fd);
+ i_close_fd(&tstream->fd);
if (tstream->buf != NULL)
buffer_free(&tstream->buf);
i_free(tstream->temp_path_prefix);
{
struct unix_istream *ustream = (struct unix_istream *)stream;
- if (ustream->read_fd != -1)
- i_close_fd(&ustream->read_fd);
+ i_close_fd(&ustream->read_fd);
i_stream_file_close(stream, close_parent);
}
/* see if it really exists */
fd = net_connect_unix(path);
if (fd != -1 || errno != ECONNREFUSED) {
- if (fd != -1) i_close_fd(&fd);
+ i_close_fd(&fd);
errno = EADDRINUSE;
return -1;
}
{
struct unix_ostream *ustream = (struct unix_ostream *)stream;
- if (ustream->write_fd != -1)
- i_close_fd(&ustream->write_fd);
+ i_close_fd(&ustream->write_fd);
o_stream_file_close(stream, close_parent);
}
after 3 times just fail here. */
fd = net_connect_unix(set->path);
if (fd != -1 || errno != ECONNREFUSED || i >= 3) {
- if (fd != -1)
- i_close_fd(&fd);
+ i_close_fd(&fd);
service_error(service, "Socket already exists: %s",
set->path);
return 0;
array_foreach(&service->listeners, listeners) {
struct service_listener *l = *listeners;
- if (l->fd != -1)
- i_close_fd(&l->fd);
+ i_close_fd(&l->fd);
}
}
if (service_list->io_master != NULL)
io_remove(&service_list->io_master);
- if (service_list->master_fd != -1)
- i_close_fd(&service_list->master_fd);
+ i_close_fd(&service_list->master_fd);
array_foreach(&service_list->services, services)
service_monitor_stop(*services);
str_tabescape(user->username),
str_tabescape(ctx->first_box_vname));
fd = fts_indexer_cmd(user, cmd, &path);
- if (fd != -1)
- i_close_fd(&fd);
+ i_close_fd(&fd);
}
}
struct fts_expunge_log *log = *_log;
*_log = NULL;
- if (log->fd != -1)
- i_close_fd(&log->fd);
+ i_close_fd(&log->fd);
i_free(log->path);
i_free(log);
}
{
struct maildir_quota_root *root = (struct maildir_quota_root *)_root;
- if (root->fd != -1)
- i_close_fd(&root->fd);
+ i_close_fd(&root->fd);
i_free(root);
}
i_close_fd(&root->fd);
(void)maildirsize_recalculate(root);
} else if (maildirsize_update(root, ctx->count_used, ctx->bytes_used) < 0) {
- if (root->fd != -1)
- i_close_fd(&root->fd);
+ i_close_fd(&root->fd);
maildirsize_rebuild_later(root);
}
void mail_stats_fill_global_deinit(void)
{
- if (proc_io_fd != -1)
- i_close_fd(&proc_io_fd);
+ i_close_fd(&proc_io_fd);
}
io_remove(&ctx->io);
if (ctx->to != NULL)
timeout_remove(&ctx->to);
- if (ctx->fd != -1)
- i_close_fd(&ctx->fd);
+ i_close_fd(&ctx->fd);
pool_unref(&ctx->pool);
}