mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Make some touchups
This commit is contained in:
parent
6c49e36537
commit
2e3958c6dc
11 changed files with 161 additions and 63 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "libc/calls/termios.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/promises.internal.h"
|
||||
#include "libc/log/color.internal.h"
|
||||
#include "libc/log/internal.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
|
@ -47,8 +48,7 @@ static union metatermios __oldtermios;
|
|||
static textstartup void __oldtermios_init() {
|
||||
int e;
|
||||
e = errno;
|
||||
if (!IsOpenbsd() && // avoid pledge(tty)
|
||||
sys_ioctl(0, TCGETS, &__oldtermios) != -1) {
|
||||
if (PLEDGED(TTY) && sys_ioctl(0, TCGETS, &__oldtermios) != -1) {
|
||||
__isrestorable = true;
|
||||
}
|
||||
errno = e;
|
||||
|
@ -60,7 +60,7 @@ const void *const __oldtermios_ctor[] initarray = {
|
|||
|
||||
void __restore_tty(void) {
|
||||
int e;
|
||||
if (__isrestorable && !__isworker && !__nocolor) {
|
||||
if (__isrestorable && PLEDGED(TTY) && !__isworker && !__nocolor) {
|
||||
e = errno;
|
||||
sys_write(0, ANSI_RESTORE, __strlen(ANSI_RESTORE));
|
||||
sys_ioctl(0, TCSETSF, &__oldtermios);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue