mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Use stat to get file details
This commit is contained in:
parent
70d1b0d4d8
commit
a6976550f1
11
src/nnn.c
11
src/nnn.c
|
@ -2650,18 +2650,11 @@ nochange:
|
||||||
mkpath(path, dents[cur].name, newpath, PATH_MAX);
|
mkpath(path, dents[cur].name, newpath, PATH_MAX);
|
||||||
DPRINTF_S(newpath);
|
DPRINTF_S(newpath);
|
||||||
|
|
||||||
/* Get path info */
|
/* Cannot use stale data in entry, file may be missing by now */
|
||||||
fd = open(newpath, O_RDONLY | O_NONBLOCK);
|
if (stat(newpath, &sb) == -1) {
|
||||||
if (fd == -1) {
|
|
||||||
printwarn();
|
printwarn();
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
}
|
||||||
if (fstat(fd, &sb) == -1) {
|
|
||||||
printwarn();
|
|
||||||
close(fd);
|
|
||||||
goto nochange;
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
DPRINTF_U(sb.st_mode);
|
DPRINTF_U(sb.st_mode);
|
||||||
|
|
||||||
switch (sb.st_mode & S_IFMT) {
|
switch (sb.st_mode & S_IFMT) {
|
||||||
|
|
Loading…
Reference in a new issue