1 diff --git a/CHANGELOG b/CHANGELOG
2 index 2db9b39..dd08880 100644
6 - fix forground logging and add option to man page.
7 - remove unjustified, nasty comment about krb5 package.
8 - fix deadlock in submount mount module.
9 +- fix lack of ferror() checking when reading files.
11 18/06/2007 autofs-5.0.2
12 -----------------------
13 diff --git a/daemon/automount.c b/daemon/automount.c
14 index 930b13f..70a3b9d 100644
15 --- a/daemon/automount.c
16 +++ b/daemon/automount.c
17 @@ -978,7 +978,7 @@ static void *do_read_master(void *arg)
21 - defaults_read_config();
22 + defaults_read_config(1);
24 status = master_read_master(master, age, readall);
26 @@ -1465,7 +1465,7 @@ int main(int argc, char *argv[])
30 - defaults_read_config();
31 + defaults_read_config(0);
33 kpkt_len = get_kpkt_len();
34 timeout = defaults_get_timeout();
35 diff --git a/include/defaults.h b/include/defaults.h
36 index 46393d9..0e0e2a5 100644
37 --- a/include/defaults.h
38 +++ b/include/defaults.h
43 -unsigned int defaults_read_config(void);
44 +unsigned int defaults_read_config(unsigned int);
45 const char *defaults_get_master_map(void);
46 unsigned int defaults_get_timeout(void);
47 unsigned int defaults_get_browse_mode(void);
48 diff --git a/lib/defaults.c b/lib/defaults.c
49 index bf1ceed..2cccf20 100644
52 @@ -280,7 +280,7 @@ struct list_head *defaults_get_uris(void)
53 * is valid bourne shell script without spaces around "="
54 * and that it has valid values.
56 -unsigned int defaults_read_config(void)
57 +unsigned int defaults_read_config(unsigned int to_syslog)
60 char buf[MAX_LINE_LEN];
61 @@ -312,9 +312,16 @@ unsigned int defaults_read_config(void)
66 - fprintf(stderr, "fgets returned error %d while reading %s\n",
67 - ferror(f), DEFAULTS_CONFIG_FILE);
68 + if (!feof(f) || ferror(f)) {
71 + "fgets returned error %d while reading %s\n",
72 + ferror(f), DEFAULTS_CONFIG_FILE);
75 + "fgets returned error %d while reading %s",
76 + ferror(f), DEFAULTS_CONFIG_FILE);
81 diff --git a/modules/lookup_file.c b/modules/lookup_file.c
82 index 6346602..31ee0fb 100644
83 --- a/modules/lookup_file.c
84 +++ b/modules/lookup_file.c
85 @@ -442,6 +442,11 @@ int lookup_read_master(struct master *master, time_t age, void *context)
90 + warn(LOGOPT_ANY, MODPREFIX
91 + "error reading map %s", ctxt->mapname);
97 @@ -683,6 +688,11 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
102 + warn(LOGOPT_ANY, MODPREFIX
103 + "error reading map %s", ctxt->mapname);
109 @@ -848,6 +858,12 @@ static int lookup_one(struct autofs_point *ap,
115 + warn(LOGOPT_ANY, MODPREFIX
116 + "error reading map %s", ctxt->mapname);
122 @@ -907,6 +923,12 @@ static int lookup_wild(struct autofs_point *ap, struct lookup_context *ctxt)
128 + warn(LOGOPT_ANY, MODPREFIX
129 + "error reading map %s", ctxt->mapname);