From ff3392b9c9471cd6d837a9ab3abe135ab2d75edf Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 22 Oct 2010 17:25:15 +0200 Subject: introduce and use xmalloc_fgets/fgetline This fixes problems of having long lines truncated - and we do have very long lines sometimes - curl errors with HTML, list of debuginfos etc. Signed-off-by: Denys Vlasenko --- src/cli/report.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/cli/report.cpp') diff --git a/src/cli/report.cpp b/src/cli/report.cpp index 46205f7e..b6edef9a 100644 --- a/src/cli/report.cpp +++ b/src/cli/report.cpp @@ -542,10 +542,9 @@ static bool ask_yesno(const char *question) /* The response might take more than 1 char in non-latin scripts. */ const char *yes = _("y"); const char *no = _("N"); - char *full_question = xasprintf("%s [%s/%s]: ", question, yes, no); - printf(full_question); - free(full_question); + printf("%s [%s/%s]: ", question, yes, no); fflush(NULL); + char answer[16]; fgets(answer, sizeof(answer), stdin); /* Use strncmp here because the answer might contain a newline as -- cgit