From a9390d3047b7b7aba6f73c20e3dff292f7600a9f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 3 Oct 2008 14:58:41 -0700 Subject: Correctly fix smbclient to terminate on eof from server. Jeremy. --- source3/lib/readline.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source3/lib/readline.c') diff --git a/source3/lib/readline.c b/source3/lib/readline.c index 254f55c86a..fd57799b57 100644 --- a/source3/lib/readline.c +++ b/source3/lib/readline.c @@ -45,6 +45,16 @@ # define RL_COMPLETION_CAST #endif /* HAVE_NEW_LIBREADLINE */ +static bool smb_rl_done; + +void smb_readline_done(void) +{ + smb_rl_done = true; +#if HAVE_LIBREADLINE + rl_done = 1; +#endif +} + /**************************************************************************** Display the prompt and wait for input. Call callback() regularly ****************************************************************************/ @@ -69,7 +79,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void) return NULL; } - while (1) { + while (!smb_rl_done) { timeout.tv_sec = 5; timeout.tv_usec = 0; @@ -87,6 +97,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void) callback(); } } + return NULL; } /**************************************************************************** -- cgit From 01ecd766c86ad49c7d8b9095bef76b5dcc71d757 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 5 Oct 2008 13:12:31 +0200 Subject: OS/X does not have rl_done in readline.h --- source3/lib/readline.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/lib/readline.c') diff --git a/source3/lib/readline.c b/source3/lib/readline.c index fd57799b57..cafb5a9f62 100644 --- a/source3/lib/readline.c +++ b/source3/lib/readline.c @@ -47,6 +47,14 @@ static bool smb_rl_done; +#if HAVE_LIBREADLINE +/* + * MacOS/X does not have rl_done in readline.h, but + * readline.so has it + */ +extern int rl_done; +#endif + void smb_readline_done(void) { smb_rl_done = true; -- cgit