diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-07-13 05:58:15 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-07-13 05:58:15 +0000 |
commit | aaac0102cb0656f3c83df4d9707c6d892472ba66 (patch) | |
tree | f273467c5021c6cdc36c0bd3229ac9434a0eb031 | |
parent | f0fc7264f4b3389dd2f5d2a2509b847a1b43cbfc (diff) |
If we fail to open the output file, report the reason why.
svn path=/trunk/; revision=11371
-rw-r--r-- | mergecap.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/mergecap.c b/mergecap.c index ac3233509e..6a798e4e3e 100644 --- a/mergecap.c +++ b/mergecap.c @@ -1,6 +1,6 @@ /* Combine two dump files, either by appending or by merging by timestamp * - * $Id: mergecap.c,v 1.25 2004/07/12 21:00:40 ulfl Exp $ + * $Id: mergecap.c,v 1.26 2004/07/13 05:58:15 guy Exp $ * * Written by Scott Renfro <scott@renfro.org> based on * editcap by Richard Sharpe and Guy Harris @@ -13,6 +13,7 @@ #include <stdio.h> #include <stdlib.h> +#include <errno.h> #include <glib.h> #ifdef HAVE_UNISTD_H @@ -197,10 +198,11 @@ main(int argc, char *argv[]) /* open the outfile */ out_file.fd = open(out_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); } - if(out_file.fd == -1) { - fprintf(stderr, "mergecap: couldn't open output file\n"); - exit(1); - } + if (out_file.fd == -1) { + fprintf(stderr, "mergecap: Couldn't open output file %s: %s\n", + out_filename, strerror(errno)); + exit(1); + } /* prepare the outfile */ if (!merge_open_outfile(&out_file, merge_max_snapshot_length(in_file_count, in_files), &err)) { |