diff --git a/scheme/ftpd/ftpd.scm b/scheme/ftpd/ftpd.scm index 6c01a00..1237ee6 100644 --- a/scheme/ftpd/ftpd.scm +++ b/scheme/ftpd/ftpd.scm @@ -515,34 +515,38 @@ ;; (log (syslog-level debug) ;; "handling command ~S with argument ~S" ;; command arg) - (with-fatal-error-handler* - (lambda (condition more) - (cond - ((error? condition) - (let ((reason (condition-stuff condition))) - (log (syslog-level notice) - "internal error occured: ~S (maybe reason: ~S) -- replying and escaping (451)" - condition reason) - (replace-reply! 451 - (format #f "Internal error: ~S" reason)))) - ((ftpd-error? condition) - ;; debug level because nearly every unsuccessful command ends - ;; here (no args, can't change dir, etc.) - (log (syslog-level debug) - "ftpd error occured (maybe reason: ~S)-- escaping" (condition-stuff condition))) - (else - (more)))) - (lambda () - (with-errno-handler* - (lambda (errno packet) - (let ((unix-error (car packet))) - (log (syslog-level notice) - "unix error occured: ~S -- replying (451) and escaping" - unix-error) - (replace-reply! 451 - (format #f "Unix error: ~A." unix-error)))) + (call-with-current-continuation + (lambda (exit) + (with-handler + (lambda (condition more) + (cond + ((error? condition) + (let ((reason (condition-stuff condition))) + (log (syslog-level notice) + "internal error occured: ~S (maybe reason: ~S) -- replying and escaping (451)" + condition reason) + (replace-reply! 451 + (format #f "Internal error: ~S" reason)) + (exit))) + ((ftpd-error? condition) + ;; debug level because nearly every unsuccessful command ends + ;; here (no args, can't change dir, etc.) + (log (syslog-level debug) + "ftpd error occured (maybe reason: ~S)-- escaping" (condition-stuff condition)) + (exit)) + (else + (more)))) (lambda () - (dispatch-command command arg)))))) + (with-errno-handler* + (lambda (errno packet) + (let ((unix-error (car packet))) + (log (syslog-level notice) + "unix error occured: ~S -- replying (451) and escaping" + unix-error) + (replace-reply! 451 + (format #f "Unix error: ~A." unix-error)))) + (lambda () + (dispatch-command command arg)))))))) (define (dispatch-command command arg) ; (log (syslog-level debug)