aboutsummaryrefslogtreecommitdiffstats
path: root/src/initlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/initlog.c')
-rw-r--r--src/initlog.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/initlog.c b/src/initlog.c
index 32fa41db..deeb9443 100644
--- a/src/initlog.c
+++ b/src/initlog.c
@@ -42,9 +42,16 @@ void readConfiguration(char *fname) {
int lfac=-1,lpri=-1;
if ((fd=open(fname,O_RDONLY))==-1) return;
- if (fstat(fd,&sbuf)) return;
+ if (fstat(fd,&sbuf)) {
+ close(fd);
+ return;
+ }
data=malloc(sbuf.st_size+1);
- if (read(fd,data,sbuf.st_size)!=sbuf.st_size) return;
+ if (read(fd,data,sbuf.st_size)!=sbuf.st_size) {
+ close(fd);
+ return;
+ }
+ close(fd);
data[sbuf.st_size] = '\0';
while ((line=getLine(&data))) {
if (line[0]=='#') continue;