Ticket #1254: stty-should-not-segfault.patch
File stty-should-not-segfault.patch, 850 bytes (added by , 9 years ago) |
---|
-
stty.scm
old new 370 370 371 371 (define (stty . args) 372 372 373 ( let* ((port (if (and (pair? args) (port? (car args)))373 (and-let* ((port (if (and (pair? args) (port? (car args))) 374 374 (car args) 375 375 (current-input-port))) 376 376 (attr (get-terminal-attributes port)) … … 438 438 (define (with-stty setting thunk) 439 439 (let* ((port (current-input-port)) 440 440 (orig-attrs (get-terminal-attributes port))) 441 (if orig-attrs 441 442 (dynamic-wind 442 443 (lambda () 443 444 (stty setting)) 444 445 thunk 445 446 (lambda () 446 447 (set-terminal-attributes! port TCSANOW orig-attrs) 447 (free-term-attrs orig-attrs))))) 448 (free-term-attrs orig-attrs))) 449 (thunk)))) 448 450 449 451 )