diff options
author | Bill Meier <wmeier@newsguy.com> | 2007-02-19 04:48:02 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2007-02-19 04:48:02 +0000 |
commit | 4c5da0a9f61c197989f71407c17a789b9c2cc8ad (patch) | |
tree | 8a23e82eb73333a65d81c6d95d0215007b828ea2 /capture_loop.c | |
parent | 3dbfb21cf9da510edd2d3e5426f99b5a51f1f998 (diff) |
Fix error handling for invalid named pipe;
Generate correct message;
(test suite 'tshark invalid capture interface' test
should now work again).
svn path=/trunk/; revision=20851
Diffstat (limited to 'capture_loop.c')
-rw-r--r-- | capture_loop.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/capture_loop.c b/capture_loop.c index 18afa7a1e2..7c198cbb65 100644 --- a/capture_loop.c +++ b/capture_loop.c @@ -301,7 +301,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld, * "\\<server>\pipe\<pipename>". <server> may be "." for localhost. */ pncopy = g_strdup(pipename); - if (strstr(pncopy, "\\\\") == pncopy) { + if ( (pos=strstr(pncopy, "\\\\")) == pncopy) { pos = strchr(pncopy + 3, '\\'); if (pos && g_strncasecmp(pos, PIPE_STR, strlen(PIPE_STR)) != 0) pos = NULL; @@ -363,6 +363,7 @@ cap_pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld, g_snprintf(errmsg, errmsgl, "The capture session could not be initiated. Unable to open interface."); + ld->cap_pipe_err = PIPNEXIST; return -1; #endif /* Enable/disable Windows named pipes */ #endif /* _WIN32 */ @@ -702,6 +703,7 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld, /* Try to open it as a pipe */ ld->cap_pipe_fd = cap_pipe_open_live(capture_opts->iface, &ld->cap_pipe_hdr, ld, errmsg, errmsg_len); + secondary_errmsg[0] = '\0'; if (ld->cap_pipe_fd == -1) { if (ld->cap_pipe_err == PIPNEXIST) { |