From aaefe8bc83b884e4b05274abd0ca948f9450f71f Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Thu, 4 Dec 2014 18:46:44 +0530 Subject: [PATCH] Remove illogical assertion in ftp.c A call to assert(1) will always fail and cause Wget to crash. If such a situation does arise, Wget should invoke abort() and provide a useful error message to the user prior to exiting. --- src/ChangeLog | 4 ++++ src/ftp.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e2b3c305..9d1c4666 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-12-04 Darshit Shah + + * ftp.c (getftp): Remove a call to assert(1) and replace with error message + 2014-12-04 Darshit Shah * wget.h: Define MIX and MAX macros globally for all files diff --git a/src/ftp.c b/src/ftp.c index 9ea88196..c159b9bb 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -724,8 +724,10 @@ Error in server response, closing control connection.\n")); break; default: - /* Can't happen. */ - assert (1); + logprintf (LOG_ALWAYS, _("Logically impossible section reached in getftp()")); + logprintf (LOG_ALWAYS, _("cwd_count: %d\ncwd_start: %d\ncwd_end: %d\n"), + cwd_count, cwd_start, cwd_end); + abort (); } if (!opt.server_response)