Text   |  XML   |  ReML   |   Visible Warnings:

Negative file descriptor  at rawlog.c:238

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

rawlog_proxy_create

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/util/rawlog.c)expand/collapse
Show more  
 245  static struct rawlog_proxy *
 246  rawlog_proxy_create(int client_in_fd, int client_out_fd, int server_fd,
 247                      const char *path, enum rawlog_flags flags)
 248  {
 249          struct rawlog_proxy *proxy;
 250   
 251[+]         proxy = i_new(struct rawlog_proxy, 1);
 252          proxy->server_fd = server_fd;
 253          proxy->server_input =
 254                  i_stream_create_fd(server_fd, MAX_PROXY_INPUT_SIZE, FALSE);
 255          proxy->server_output = o_stream_create_fd(server_fd, (size_t)-1, FALSE);
 256          proxy->server_io = io_add(server_fd, IO_READ, server_input, proxy);
 257          o_stream_set_flush_callback(proxy->server_output, server_output, proxy);
 258   
 259          proxy->client_in_fd = client_in_fd;
 260          proxy->client_out_fd = client_out_fd;
 261          proxy->client_output =
 262                  o_stream_create_fd(client_out_fd, (size_t)-1, FALSE);
 263          proxy->client_io = io_add(proxy->client_in_fd, IO_READ,
 264                                    client_input, proxy);
 265          o_stream_set_flush_callback(proxy->client_output, client_output, proxy);
 266   
 267          proxy->last_out_lf = TRUE;
 268          proxy->flags = flags;
 269   
 270          proxy->fd_in = proxy->fd_out = -1;
 271[+]         proxy_open_logs(proxy, path);
expand/collapse

proxy_open_logs

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/util/rawlog.c)expand/collapse
Show more  
 210  static void proxy_open_logs(struct rawlog_proxy *proxy, const char *path)
 211  {
 212          time_t now;
 213          struct tm *tm;
 214          const char *fname;
 215          char timestamp[50];
 216   
 217          now = time(NULL);
 218          tm = localtime(&now);
 219          if (strftime(timestamp, sizeof(timestamp), "%Y%m%d-%H%M%S", tm) <= 0)
 220                  i_fatal("strftime() failed");
 221   
 222          if ((proxy->flags & RAWLOG_FLAG_LOG_INPUT) != 0) {
 223                  fname = t_strdup_printf("%s/%s-%s.in", path, timestamp,
 224                                          dec2str(getpid()));
 225                  proxy->fd_in = open(fname, O_CREAT|O_EXCL|O_WRONLY, 0600);
 226                  if (proxy->fd_in == -1) {
 227                          i_error("rawlog_open: open() failed for %s: %m", fname);
 228                          return;
 229                  }
 230          }
 231   
 232          if ((proxy->flags & RAWLOG_FLAG_LOG_OUTPUT) != 0) {
 233                  fname = t_strdup_printf("%s/%s-%s.out", path, timestamp,
 234                                          dec2str(getpid()));
 235                  proxy->fd_out = open(fname, O_CREAT|O_EXCL|O_WRONLY, 0600);
 236                  if (proxy->fd_out == -1) {
 237                          i_error("rawlog_open: open() failed for %s: %m", fname);
 238                          (void)close(proxy->fd_in);
Show more  
Show more  




Change Warning 8032.24842 : Negative file descriptor

Priority:
State:
Finding:
Owner:
Note: