aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>1999-11-15 17:03:35 +0000
committerBill Nottingham <notting@redhat.com>1999-11-15 17:03:35 +0000
commite042728368d23e120eb0ad92421c086edaf25bb7 (patch)
treee2a6096705eeb1fbe9300b0df9030533a20470be /src
parent70169370bd5460f433da742fa2e2bfcce1ee7add (diff)
downloadinitscripts-e042728368d23e120eb0ad92421c086edaf25bb7.tar
initscripts-e042728368d23e120eb0ad92421c086edaf25bb7.tar.gz
initscripts-e042728368d23e120eb0ad92421c086edaf25bb7.tar.bz2
initscripts-e042728368d23e120eb0ad92421c086edaf25bb7.tar.xz
initscripts-e042728368d23e120eb0ad92421c086edaf25bb7.zip
close configuration file descriptor
Diffstat (limited to 'src')
-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;