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