From ef7082b69181fa4857486e473ef67b04b1186be1 Mon Sep 17 00:00:00 2001 From: sin Date: Wed, 22 Oct 2014 14:33:00 +0100 Subject: [PATCH] Use stat() instead of open() + fstat() --- noice.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/noice.c b/noice.c index f41c90aa..ff11b2f2 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; }