summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2013-06-04 12:53:18 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2013-06-04 12:53:18 +0000
commit9b9d8e479301106c9d6db74061fbd224958f810d (patch)
tree3001cd53e7616dbd4c19c0a6da81b6af6fb9b909
parentfad7707669501a8a2433d0e11cabf2155cc4d484 (diff)
- motd.c:motd_cache(): do the stat() before fopen() + improve error
reporting in case stat() failed git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2191 82007160-df01-0410-b94d-b575c5fd34c7
-rw-r--r--src/motd.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/motd.c b/src/motd.c
index 889d04e..21218e3 100644
--- a/src/motd.c
+++ b/src/motd.c
@@ -126,18 +126,19 @@ motd_cache(struct Motd *motd)
}
}
- /* gotta read in the file, now */
- if ((file = fopen(motd->path, "r")) == NULL)
+ /* need the file's modification time */
+ if (stat(motd->path, &sb) == -1)
{
- ilog(LOG_TYPE_IRCD, "Couldn't open \"%s\": %s", motd->path,
+ ilog(LOG_TYPE_IRCD, "Couldn't stat \"%s\": %s", motd->path,
strerror(errno));
return 0;
}
- /* need the file's modification time */
- if (stat(motd->path, &sb) == -1)
+ /* gotta read in the file, now */
+ if ((file = fopen(motd->path, "r")) == NULL)
{
- fclose(file);
+ ilog(LOG_TYPE_IRCD, "Couldn't open \"%s\": %s", motd->path,
+ strerror(errno));
return 0;
}