From: Thibault Godouet Date: Sun, 13 Apr 2014 17:57:10 +0000 (+0100) Subject: fcrondyn with readline no longer crashes when receiving EOF X-Git-Tag: ver3_1_3~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a56c1edd7f0c9ec958a0cdafc33de57a43b4831;p=thirdparty%2Ffcron.git fcrondyn with readline no longer crashes when receiving EOF --- diff --git a/doc/en/changes.sgml b/doc/en/changes.sgml index 8750ddb..f22892e 100644 --- a/doc/en/changes.sgml +++ b/doc/en/changes.sgml @@ -26,6 +26,9 @@ A copy of the license is included in gfdl.sgml. Fixed minor bug in fcronsighup resulting in log errors about closing the signal file + + fcrondyn no longer crashes when receiving an EOF when using readline (thanks Wade Carpenter for the patch) + diff --git a/fcrondyn.c b/fcrondyn.c index 294768f..c4140a1 100644 --- a/fcrondyn.c +++ b/fcrondyn.c @@ -695,6 +695,13 @@ interactive_mode(int fd) while (1) { line_read = readline("fcrondyn> "); + + if (line_read == NULL) { + /* Handle EOF gracefully and move past the prompt line */ + printf("\n"); + break; + } + return_code = talk_fcron(line_read, fd); #ifdef HAVE_READLINE_HISTORY