aboutsummaryrefslogtreecommitdiffstats
path: root/print.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2004-01-24 10:53:25 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2004-01-24 10:53:25 +0000
commit484071c232b2f8512db920efa9148473c59f726d (patch)
tree4f33de0c36a5dc83443857df1e1cd4ff680fbe32 /print.c
parentc484a2b17f88a61c345a776443722d07e094b06c (diff)
As with "file_write_error_message()", so with
"file_close_error_message()" - but just use "file_write_error_message()" for UNIX-style errors, under the assumption that a close will only fail because a buffer-flushing write fails or because "close()" itself fails when, for example, pushing unsynced NFS client-side writes out over the wire. Make several routines in "print.c" return success/failure indications. Check for write errors when printing "Follow TCP Stream" stuff or saving it to a file. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9825 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'print.c')
-rw-r--r--print.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/print.c b/print.c
index b9b5a5a847..e96b2e67d5 100644
--- a/print.c
+++ b/print.c
@@ -1,7 +1,7 @@
/* print.c
* Routines for printing packet analysis trees.
*
- * $Id: print.c,v 1.69 2004/01/09 18:49:31 sharpe Exp $
+ * $Id: print.c,v 1.70 2004/01/24 10:53:24 guy Exp $
*
* Gilbert Ramirez <gram@alumni.rice.edu>
*
@@ -78,13 +78,13 @@ FILE *open_print_dest(int to_file, const char *dest)
return fh;
}
-void close_print_dest(int to_file, FILE *fh)
+gboolean close_print_dest(int to_file, FILE *fh)
{
/* Close the file or command */
if (to_file)
- fclose(fh);
+ return (fclose(fh) == 0);
else
- pclose(fh);
+ return (pclose(fh) == 0);
}
@@ -650,27 +650,31 @@ void ps_clean_string(unsigned char *out, const unsigned char *in,
}
/* Some formats need stuff at the beginning of the output */
-void
+gboolean
print_preamble(FILE *fh, gint format)
{
if (format == PR_FMT_PS)
- print_ps_preamble(fh);
+ return !print_ps_preamble(fh);
else if (format == PR_FMT_PDML) {
fputs("<?xml version=\"1.0\"?>\n", fh);
fputs("<pdml version=\"" PDML_VERSION "\" ", fh);
fprintf(fh, "creator=\"%s/%s\">\n", PACKAGE, VERSION);
- }
+ return !ferror(fh);
+ } else
+ return TRUE;
}
/* Some formats need stuff at the end of the output */
-void
+gboolean
print_finale(FILE *fh, gint format)
{
if (format == PR_FMT_PS)
- print_ps_finale(fh);
+ return !print_ps_finale(fh);
else if (format == PR_FMT_PDML) {
fputs("</pdml>\n", fh);
- }
+ return !ferror(fh);
+ } else
+ return TRUE;
}
void