aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar sin <sin@2f30.org>2014-10-22 14:33:00 +0100
committerGravatar sin <sin@2f30.org>2014-10-22 14:33:17 +0100
commitef7082b69181fa4857486e473ef67b04b1186be1 (patch)
tree31dba0d6ef5b0eb39f8b1e8ebcd4c705eea0bb96
parent5aceade801f5d7c7cf44e528a9eae3ff24edfc72 (diff)
downloadnnn-ef7082b69181fa4857486e473ef67b04b1186be1.tar.gz
Use stat() instead of open() + fstat()
-rw-r--r--noice.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/noice.c b/noice.c
index f41c90a..ff11b2f 100644
--- a/noice.c
+++ b/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;
}