forked from enlightenment/terminology
tycat/tyls: handle error on write()/scanf()
This commit is contained in:
parent
58a1adac38
commit
a119ac10cc
|
@ -337,7 +337,11 @@ main(int argc, char **argv)
|
|||
echo_off();
|
||||
snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
|
||||
if (ty_write(1, buf, strlen(buf) + 1) < 0)
|
||||
perror("write");
|
||||
{
|
||||
perror("write");
|
||||
echo_on();
|
||||
goto shutdown;
|
||||
}
|
||||
if (scanf("%i;%i;%i;%i", &tw, &th, &cw, &ch) != 4 ||
|
||||
((tw <= 0) || (th <= 0) || (cw <= 1) || (ch <= 1)))
|
||||
{
|
||||
|
|
|
@ -760,18 +760,22 @@ main(int argc, char **argv)
|
|||
int i, cw, ch;
|
||||
int len;
|
||||
char *rp;
|
||||
|
||||
|
||||
evas = ecore_evas_get(ee);
|
||||
echo_off();
|
||||
snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
|
||||
len = strlen(buf);
|
||||
if (ty_write(1, buf, len + 1) < (signed)len + 1)
|
||||
perror("write");
|
||||
{
|
||||
perror("write");
|
||||
echo_on();
|
||||
return -1;
|
||||
}
|
||||
if ((scanf("%i;%i;%i;%i", &tw, &th, &cw, &ch) != 4)
|
||||
|| (tw <= 0) || (th <= 0) || (cw <= 1) || (ch <= 1))
|
||||
{
|
||||
echo_on();
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
echo_on();
|
||||
for (i = 1; i < argc; i++)
|
||||
|
|
Loading…
Reference in New Issue