fix cross-compilation on Windows 11 Arm64
signal.h is less populated in this environment, remove stub signal handlers
This commit is contained in:
parent
98a5122bc6
commit
dd1d96f643
@ -139,9 +139,6 @@ static int is_a_tty;
|
|||||||
|
|
||||||
/* Declare static functions */
|
/* Declare static functions */
|
||||||
static int read_till_nl(FILE *);
|
static int read_till_nl(FILE *);
|
||||||
static void recsig(int);
|
|
||||||
static void pushsig(void);
|
|
||||||
static void popsig(void);
|
|
||||||
static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl);
|
static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl);
|
||||||
|
|
||||||
static int read_string(UI *ui, UI_STRING *uis);
|
static int read_string(UI *ui, UI_STRING *uis);
|
||||||
@ -236,8 +233,6 @@ read_till_nl(FILE *in)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static volatile sig_atomic_t intr_signal;
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
|
read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
|
||||||
{
|
{
|
||||||
@ -247,12 +242,9 @@ read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
|
|||||||
int maxsize = BUFSIZ - 1;
|
int maxsize = BUFSIZ - 1;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
intr_signal = 0;
|
|
||||||
ok = 0;
|
ok = 0;
|
||||||
ps = 0;
|
ps = 0;
|
||||||
|
|
||||||
pushsig();
|
|
||||||
|
|
||||||
ps = 1;
|
ps = 1;
|
||||||
|
|
||||||
if (!echo && !noecho_console(ui))
|
if (!echo && !noecho_console(ui))
|
||||||
@ -276,16 +268,11 @@ read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
|
|||||||
ok = 1;
|
ok = 1;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (intr_signal == SIGINT)
|
|
||||||
ok = -1;
|
|
||||||
if (!echo)
|
if (!echo)
|
||||||
fprintf(tty_out, "\n");
|
fprintf(tty_out, "\n");
|
||||||
if (ps >= 2 && !echo && !echo_console(ui))
|
if (ps >= 2 && !echo && !echo_console(ui))
|
||||||
ok = 0;
|
ok = 0;
|
||||||
|
|
||||||
if (ps >= 1)
|
|
||||||
popsig();
|
|
||||||
|
|
||||||
explicit_bzero(result, BUFSIZ);
|
explicit_bzero(result, BUFSIZ);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -348,32 +335,3 @@ close_console(UI *ui)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal functions to handle signals and act on them */
|
|
||||||
static void
|
|
||||||
pushsig(void)
|
|
||||||
{
|
|
||||||
savsig[SIGABRT] = signal(SIGABRT, recsig);
|
|
||||||
savsig[SIGFPE] = signal(SIGFPE, recsig);
|
|
||||||
savsig[SIGILL] = signal(SIGILL, recsig);
|
|
||||||
savsig[SIGINT] = signal(SIGINT, recsig);
|
|
||||||
savsig[SIGSEGV] = signal(SIGSEGV, recsig);
|
|
||||||
savsig[SIGTERM] = signal(SIGTERM, recsig);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
popsig(void)
|
|
||||||
{
|
|
||||||
signal(SIGABRT, savsig[SIGABRT]);
|
|
||||||
signal(SIGFPE, savsig[SIGFPE]);
|
|
||||||
signal(SIGILL, savsig[SIGILL]);
|
|
||||||
signal(SIGINT, savsig[SIGINT]);
|
|
||||||
signal(SIGSEGV, savsig[SIGSEGV]);
|
|
||||||
signal(SIGTERM, savsig[SIGTERM]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
recsig(int i)
|
|
||||||
{
|
|
||||||
intr_signal = i;
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user