summaryrefslogtreecommitdiff
path: root/dftest.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-08-18 18:35:21 +0000
committerGuy Harris <guy@alum.mit.edu>2003-08-18 18:35:21 +0000
commitc927dec391f6a1c25ebdad5b84575cf3fd2c31c5 (patch)
treee5d405a2e9deedd01e41717b65780ee09575c04c /dftest.c
parent908dcdf4914818b1c9ba9e9951672fa08c184d7d (diff)
downloadwireshark-c927dec391f6a1c25ebdad5b84575cf3fd2c31c5.tar.gz
Add checks for read errors in "read_prefs()".
svn path=/trunk/; revision=8183
Diffstat (limited to 'dftest.c')
-rw-r--r--dftest.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/dftest.c b/dftest.c
index 2e4559664d..35a46b4e7d 100644
--- a/dftest.c
+++ b/dftest.c
@@ -1,6 +1,6 @@
/* dftest.c.c
*
- * $Id: dftest.c,v 1.5 2002/08/28 21:00:06 jmayer Exp $
+ * $Id: dftest.c,v 1.6 2003/08/18 18:35:21 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -65,7 +65,8 @@ main(int argc, char **argv)
{
char *text;
char *gpf_path, *pf_path;
- int gpf_open_errno, pf_open_errno;
+ int gpf_open_errno, gpf_read_errno;
+ int pf_open_errno, pf_read_errno;
e_prefs *prefs;
dfilter_t *df;
@@ -83,14 +84,31 @@ main(int argc, char **argv)
/* set the c-language locale to the native environment. */
setlocale(LC_ALL, "");
- prefs = read_prefs(&gpf_open_errno, &gpf_path, &pf_open_errno, &pf_path);
+ prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
+ &pf_open_errno, &pf_read_errno, &pf_path);
if (gpf_path != NULL) {
- fprintf(stderr, "can't open global preferences file \"%s\": %s.\n",
- pf_path, strerror(gpf_open_errno));
+ if (gpf_open_errno != 0) {
+ fprintf(stderr,
+ "can't open global preferences file \"%s\": %s.\n",
+ pf_path, strerror(gpf_open_errno));
+ }
+ if (gpf_read_errno != 0) {
+ fprintf(stderr,
+ "I/O error reading global preferences file \"%s\": %s.\n",
+ pf_path, strerror(gpf_read_errno));
+ }
}
if (pf_path != NULL) {
- fprintf(stderr, "can't open your preferences file \"%s\": %s.\n",
- pf_path, strerror(pf_open_errno));
+ if (pf_open_errno != 0) {
+ fprintf(stderr,
+ "can't open your preferences file \"%s\": %s.\n",
+ pf_path, strerror(pf_open_errno));
+ }
+ if (pf_read_errno != 0) {
+ fprintf(stderr,
+ "I/O error reading your preferences file \"%s\": %s.\n",
+ pf_path, strerror(pf_read_errno));
+ }
}
/* notify all registered modules that have had any of their preferences