mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Don't use printerr() before curses has been initialized
This commit is contained in:
parent
4abc9f0b46
commit
013bcdee35
14
noice.c
14
noice.c
|
@ -885,8 +885,10 @@ main(int argc, char *argv[])
|
|||
char *ifilter;
|
||||
|
||||
/* Confirm we are in a terminal */
|
||||
if (!isatty(STDIN_FILENO))
|
||||
printerr(1, "isatty");
|
||||
if (!isatty(0) || !isatty(1)) {
|
||||
fprintf(stderr, "stdin or stdout is not a tty\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (getuid() == 0)
|
||||
ifilter = ".";
|
||||
|
@ -904,8 +906,10 @@ main(int argc, char *argv[])
|
|||
signal(SIGINT, SIG_IGN);
|
||||
|
||||
/* Test initial path */
|
||||
if (canopendir(ipath) == 0)
|
||||
printerr(1, ipath);
|
||||
if (canopendir(ipath) == 0) {
|
||||
fprintf(stderr, "%s: %s\n", ipath, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Set locale before curses setup */
|
||||
setlocale(LC_ALL, "");
|
||||
|
@ -916,5 +920,5 @@ main(int argc, char *argv[])
|
|||
|
||||
exitcurses();
|
||||
|
||||
return 0;
|
||||
exit(0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue