This is required to allow TCP rawlogs to actually work.
static void
http_client_connection_ready(struct http_client_connection *conn)
{
- struct stat st;
-
/* connected */
conn->connected = TRUE;
if (conn->to_connect != NULL &&
http_client_peer_connection_success(conn->peer);
/* start raw log */
- if (conn->client->set.rawlog_dir != NULL &&
- stat(conn->client->set.rawlog_dir, &st) == 0) {
+ if (conn->client->set.rawlog_dir != NULL) {
iostream_rawlog_create(conn->client->set.rawlog_dir,
&conn->conn.input, &conn->conn.output);
}
static int imapc_connection_ssl_init(struct imapc_connection *conn)
{
struct ssl_iostream_settings ssl_set;
- struct stat st;
const char *error;
if (conn->client->ssl_ctx == NULL) {
return -1;
}
- if (*conn->client->set.rawlog_dir != '\0' &&
- stat(conn->client->set.rawlog_dir, &st) == 0) {
+ if (*conn->client->set.rawlog_dir != '\0') {
iostream_rawlog_create(conn->client->set.rawlog_dir,
&conn->input, &conn->output);
}
static void imapc_connection_connect_next_ip(struct imapc_connection *conn)
{
const struct ip_addr *ip;
- struct stat st;
int fd;
i_assert(conn->client->set.max_idle_time > 0);
o_stream_set_no_error_handling(conn->output, TRUE);
if (*conn->client->set.rawlog_dir != '\0' &&
- conn->client->set.ssl_mode != IMAPC_CLIENT_SSL_MODE_IMMEDIATE &&
- stat(conn->client->set.rawlog_dir, &st) == 0) {
+ conn->client->set.ssl_mode != IMAPC_CLIENT_SSL_MODE_IMMEDIATE) {
iostream_rawlog_create(conn->client->set.rawlog_dir,
&conn->input, &conn->output);
}
static int pop3c_client_ssl_init(struct pop3c_client *client)
{
struct ssl_iostream_settings ssl_set;
- struct stat st;
const char *error;
if (client->ssl_ctx == NULL) {
return -1;
}
- if (*client->set.rawlog_dir != '\0' &&
- stat(client->set.rawlog_dir, &st) == 0) {
+ if (*client->set.rawlog_dir != '\0') {
iostream_rawlog_create(client->set.rawlog_dir,
&client->input, &client->output);
}
static void pop3c_client_connect_ip(struct pop3c_client *client)
{
- struct stat st;
-
client->fd = net_connect_ip(&client->ip, client->set.port, NULL);
if (client->fd == -1) {
pop3c_client_disconnect(client);
o_stream_set_no_error_handling(client->output, TRUE);
if (*client->set.rawlog_dir != '\0' &&
- client->set.ssl_mode != POP3C_CLIENT_SSL_MODE_IMMEDIATE &&
- stat(client->set.rawlog_dir, &st) == 0) {
+ client->set.ssl_mode != POP3C_CLIENT_SSL_MODE_IMMEDIATE) {
iostream_rawlog_create(client->set.rawlog_dir,
&client->input, &client->output);
}
{
static unsigned int counter = 0;
const char *timestamp, *prefix;
+ struct stat st;
int ret;
if ((ret = iostream_rawlog_try_create_tcp(dir, input, output)) != 0)
return ret < 0 ? -1 : 0;
+ if (stat(dir, &st) < 0) {
+ if (errno != ENOENT && errno != EACCES)
+ i_error("rawlog: stat(%s) failed: %m", dir);
+ return -1;
+ }
timestamp = t_strflocaltime("%Y%m%d-%H%M%S", ioloop_time);