From: Thibault Godouet Date: Sun, 13 Apr 2014 17:48:17 +0000 (+0100) Subject: fixed minor bug in fcronsighup: no need to close() after fclose() on stream from... X-Git-Tag: ver3_1_3~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b7d31ac792fa2ed121cecc84a90004e1990bf05;p=fcron fixed minor bug in fcronsighup: no need to close() after fclose() on stream from fdopen() --- diff --git a/doc/en/changes.sgml b/doc/en/changes.sgml index a2f8b5e..8750ddb 100644 --- a/doc/en/changes.sgml +++ b/doc/en/changes.sgml @@ -23,6 +23,9 @@ A copy of the license is included in gfdl.sgml. fcrondyn -x no longer adds null characters at the end of the output. This would cause problems if the output was piped to something as grep. Thanks Dimitri Semitsoglou-Tsiapos for pointing this out. + + Fixed minor bug in fcronsighup resulting in log errors about closing the signal file + diff --git a/fcronsighup.c b/fcronsighup.c index 90bd86a..c4f248d 100644 --- a/fcronsighup.c +++ b/fcronsighup.c @@ -169,8 +169,10 @@ sig_daemon(void) sleep(sl); + /* also closes the underlying file descriptor fd: */ xfclose_check(&fp, sigfile); - xclose_check(&fd, sigfile); + /* also reset fd, now closed by xfclose_check(), to make it clear it is closed */ + fd = -1; if (remove(sigfile) < 0) error_e("Could not remove %s"); diff --git a/fcrontab.c b/fcrontab.c index 8f68462..2e29c3d 100644 --- a/fcrontab.c +++ b/fcrontab.c @@ -402,6 +402,7 @@ list_file(const char *file) while ((c = getc(f)) != EOF) putchar(c); + /* also closes the underlying file descriptor fd: */ xfclose_check(&f, file); }