Fix read_schedule() not to fclose(stdin)
Did that since the initial commit 71320ed6
, v4.3.10.
This commit is contained in:
parent
881dd41626
commit
5a77a8186e
1 changed files with 6 additions and 6 deletions
|
@ -27,7 +27,7 @@
|
||||||
* rdsched.c: Read update schedule
|
* rdsched.c: Read update schedule
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Markus Armbruster, 2007-2010
|
* Markus Armbruster, 2007-2011
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _XOPEN_SOURCE 500
|
#define _XOPEN_SOURCE 500
|
||||||
|
@ -74,10 +74,8 @@ read_schedule(char *fname, time_t sched[], int n, time_t t0, time_t anchor)
|
||||||
fname, strerror(errno));
|
fname, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
fp = stdin;
|
fp = stdin;
|
||||||
fname = "<stdin>";
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = lno = 0;
|
ret = lno = 0;
|
||||||
sched[0] = 0;
|
sched[0] = 0;
|
||||||
|
@ -86,12 +84,14 @@ read_schedule(char *fname, time_t sched[], int n, time_t t0, time_t anchor)
|
||||||
endp = strchr(buf, '#');
|
endp = strchr(buf, '#');
|
||||||
if (endp)
|
if (endp)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
if (parse_schedule_line(buf, sched, n, t0, &anchor, fname, lno)) {
|
if (parse_schedule_line(buf, sched, n, t0, &anchor,
|
||||||
|
fname ? fname : "<stdin>", lno)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fname)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue