From 8a56c1edd7f0c9ec958a0cdafc33de57a43b4831 Mon Sep 17 00:00:00 2001 From: Thibault Godouet Date: Sun, 13 Apr 2014 18:57:10 +0100 Subject: [PATCH] fcrondyn with readline no longer crashes when receiving EOF --- doc/en/changes.sgml | 3 +++ fcrondyn.c | 7 +++++++ 2 files changed, 10 insertions(+) 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 -- 2.47.3