Wireshark-dev: Re: [Wireshark-dev] Delays in real-time packet capture
From: Pierre JUHEN <[email protected]>
Date: Thu, 30 Nov 2006 12:33:35 +0100 (CET)
Maybe the problems lies here (capture_opts.c) :

static gboolean capture_opts_output_to_pipe(const char *save_file, gboolean *is_pipe)
{
  int err;

  if (save_file != NULL) {
    /* We're writing to a capture file. */
    if (strcmp(save_file, "-") == 0) {
      /* Writing to stdout. */
      /* XXX - should we check whether it's a pipe?  It's arguably
         silly to do "-w - >output_file" rather than "-w output_file",
         but by not checking we might be violating the Principle Of
         Least Astonishment. */
      *is_pipe = TRUE;
    } else {
      /* not a capture file, test for a FIFO (aka named pipe) */
      err = capture_opts_test_for_fifo(save_file);
      switch (err) {

      case ENOENT:	/* it doesn't exist, so we'll be creating it,
      			   and it won't be a FIFO */
      case 0:		/* found it, but it's not a FIFO */
        break;

      case ESPIPE:	/* it is a FIFO */
        *is_pipe = TRUE;
        break;

      default:		/* couldn't stat it */
        cmdarg_err("Error testing whether capture file is a pipe: %s",
                strerror(errno));
        return 2;
      }
    }
  }

  *is_pipe = FALSE;

  return 0;
}


If you read this function, you can see that it can only set is_pipe to FALSE,
or raise an error.

The line " *is_pipe = FALSE;" should be at the beginning of the function,
not at the end.

At least for me, it fixed the problem described in bugs 1181 et 1220.

I created bug #1220 because, sorry, the keywords I used wehre not the right ones.

I attached a patch to bug #1220, but nobody seems to have taken care of.

Hope it will close the issue for you also !

Regards,

Pierre