mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Use stat() instead of open() + fstat()
This commit is contained in:
parent
5aceade801
commit
ef7082b691
12
noice.c
12
noice.c
|
@ -493,7 +493,6 @@ begin:
|
|||
char *pathnew;
|
||||
char *name;
|
||||
char *bin;
|
||||
int fd;
|
||||
char *dir;
|
||||
char *tmp;
|
||||
regex_t re;
|
||||
|
@ -583,14 +582,7 @@ nochange:
|
|||
DPRINTF_S(pathnew);
|
||||
|
||||
/* Get path info */
|
||||
fd = open(pathnew, O_RDONLY | O_NONBLOCK);
|
||||
if (fd == -1) {
|
||||
printwarn();
|
||||
free(pathnew);
|
||||
goto nochange;
|
||||
}
|
||||
r = fstat(fd, &sb);
|
||||
close(fd);
|
||||
r = stat(pathnew, &sb);
|
||||
if (r == -1) {
|
||||
printwarn();
|
||||
free(pathnew);
|
||||
|
@ -619,11 +611,9 @@ nochange:
|
|||
free(pathnew);
|
||||
goto nochange;
|
||||
}
|
||||
|
||||
exitcurses();
|
||||
spawn(bin, pathnew);
|
||||
initcurses();
|
||||
|
||||
free(pathnew);
|
||||
goto redraw;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue