aboutsummaryrefslogtreecommitdiff
path: root/debianutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-02-26 20:39:23 +0000
committerRon Yorston <rmy@pobox.com>2018-02-26 20:39:23 +0000
commit650f67507f2718dec0d4282afea619cfe7a53305 (patch)
tree82e523133f961e8337f42765307b63dc737f2580 /debianutils
parentfcb5c968bef6c4fd234e000aaeaa160ac1d16f11 (diff)
downloadbusybox-w32-650f67507f2718dec0d4282afea619cfe7a53305.tar.gz
busybox-w32-650f67507f2718dec0d4282afea619cfe7a53305.tar.bz2
busybox-w32-650f67507f2718dec0d4282afea619cfe7a53305.zip
win32: move detection of file formats to stat(2)
Move the code to detect shell scripts and binary executables from mingw_access to a separate function, has_exec_format. Call this function in do_lstat to decide whether to set the executable bits in the file mode. This will slow down stat but has a couple of advantages: - shell scripts are highlighted in ls output - the test applet can use stat(2) to detect executable files The new function is used to handle another corner case in spawnveq: binary executables without the usual .exe extension are only run by spawnve if the file name ends with '.'. Two minor changes: - file_is_win32_executable has been renamed add_win32_extension to clarify what it does - a call to file_is_executable has been removed from find_command in ash as it resulted in unhelpful error messages.
Diffstat (limited to 'debianutils')
-rw-r--r--debianutils/which.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/debianutils/which.c b/debianutils/which.c
index 13f922615..9060a5b47 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -71,7 +71,7 @@ int which_main(int argc UNUSED_PARAM, char **argv)
71 puts(*argv); 71 puts(*argv);
72 } 72 }
73#if ENABLE_PLATFORM_MINGW32 73#if ENABLE_PLATFORM_MINGW32
74 else if ((p=file_is_win32_executable(*argv)) != NULL) { 74 else if ((p=add_win32_extension(*argv)) != NULL) {
75 missing = 0; 75 missing = 0;
76 puts(p); 76 puts(p);
77 free(p); 77 free(p);