aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-03-18 22:24:21 +0000
committerRon Yorston <rmy@pobox.com>2018-03-18 22:24:21 +0000
commit666f17d12f4aa30dc41a456157647bbe97dc5c99 (patch)
tree9e402788be07bd728fda0d5b455fedf6b9145d00 /win32
parent411d8b4cf9887c108853a25388837c1aaf31edce (diff)
downloadbusybox-w32-666f17d12f4aa30dc41a456157647bbe97dc5c99.tar.gz
busybox-w32-666f17d12f4aa30dc41a456157647bbe97dc5c99.tar.bz2
busybox-w32-666f17d12f4aa30dc41a456157647bbe97dc5c99.zip
win32: don't test DLLs for executable format
Moving detection of file formats from access(2) to stat(2) in commit 650f67507 was acknowledged to slow down stat. One problematic case is c:/windows/system32 which contains about 2000 DLLs and was found to slow 'ls' unacceptably. Treat DLLs as a special case in has_exec_format. See GitHub issue #101.
Diffstat (limited to 'win32')
-rw-r--r--win32/mingw.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index 112b2a54e..9978baa7a 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -330,6 +330,11 @@ static int has_exec_format(const char *name)
330 unsigned int offset; 330 unsigned int offset;
331 unsigned char buf[1024]; 331 unsigned char buf[1024];
332 332
333 /* special case: skip DLLs, there are thousands of them! */
334 n = strlen(name);
335 if (n > 4 && !strcasecmp(name+n-4, ".dll"))
336 return 0;
337
333 fd = open(name, O_RDONLY); 338 fd = open(name, O_RDONLY);
334 if (fd < 0) 339 if (fd < 0)
335 return 0; 340 return 0;