Forbid escaping clic loading with SIGINT - clic - Clic is an command line interactive client for gopher written in Common LISP HTML git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/clic/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 22248dc9ab2895d7bcf8b3bcfcf76eb48ecc075f DIR parent be4bf91b222d03b0de1c9c83ab2afccbfa41dc28 HTML Author: Solene Rapenne <solene@perso.pw> Date: Thu, 21 Jun 2018 11:05:17 +0200 Forbid escaping clic loading with SIGINT Diffstat: M clic.lisp | 12 ++++++++---- M make-binary.lisp | 6 +++++- 2 files changed, 13 insertions(+), 5 deletions(-) --- DIR diff --git a/clic.lisp b/clic.lisp @@ -571,10 +571,8 @@ ;; split and ask to scroll or to type a command (when (= row rows) (setf row 0) - (format t "~a~a press enter or a shell command ~a : " - (get-color 'bg-black) - (if *kiosk-mode* "KIOSK" "") - (get-color 'reset)) + (format t "~a press enter or a shell command: " + (if *kiosk-mode* "KIOSK" "")) (force-output) (let ((first-input (read-char *standard-input* nil nil t))) (cond @@ -735,7 +733,13 @@ with a parameter not of type 1, so it will fetch the content, display it and exit and finally, the redirected case where clic will print to stdout and exit." + + ;; pledge support on OpenBSD (c-pledge) + + ;; re-enable SIGINT (Ctrl+C) disabled for loading clic + (ext:set-signal-handler ext:+sigint+ 'quit) + (ignore-errors ;; lisp is magic (let ((destination (car (last (loop for element in (get-argv) DIR diff --git a/make-binary.lisp b/make-binary.lisp @@ -7,7 +7,11 @@ #+ecl (progn (compile-file "clic.lisp" :system-p t) - (c:build-program "clic" :epilogue-code '(progn (handler-case (main) (condition () (quit)))) :lisp-files '("clic.o"))) + (c:build-program "clic" + :prologue-code '(ext:set-signal-handler ext:+sigint+ nil) + :epilogue-code '(progn (handler-case (main) + (condition () (quit)))) + :lisp-files '("clic.o"))) (format t "INFO => Compilation done (or at least it should be)~%") (quit)