diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-01-24 10:53:25 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-01-24 10:53:25 +0000 |
commit | 65f18bb833c0259fa3705b6f3147f95354d4a101 (patch) | |
tree | 4f33de0c36a5dc83443857df1e1cd4ff680fbe32 /print.c | |
parent | 7180513677713540595701ba3dc91c62a895fe89 (diff) | |
download | wireshark-65f18bb833c0259fa3705b6f3147f95354d4a101.tar.gz wireshark-65f18bb833c0259fa3705b6f3147f95354d4a101.tar.bz2 wireshark-65f18bb833c0259fa3705b6f3147f95354d4a101.zip |
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.
svn path=/trunk/; revision=9825
Diffstat (limited to 'print.c')
-rw-r--r-- | print.c | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -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 |