From 045c0eb7df3c169f006c8167c52648446cbdacc3 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Tue, 28 Apr 2009 15:27:57 +1000 Subject: libb/mingw_stat(): turn S_IEXEC on for .exe files --- libbb/mingw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libbb/mingw.c b/libbb/mingw.c index 1293dc7eb..aa1417acf 100644 --- a/libbb/mingw.c +++ b/libbb/mingw.c @@ -203,11 +203,15 @@ static int do_lstat(const char *file_name, struct stat *buf) WIN32_FILE_ATTRIBUTE_DATA fdata; if (!(errno = get_file_attr(file_name, &fdata))) { + int len = strlen(file_name); + buf->st_ino = 0; buf->st_gid = 0; buf->st_uid = 0; buf->st_nlink = 1; buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes); + if (len > 4 && !strcmp(file_name+len-4, ".exe")) + buf->st_mode |= S_IEXEC; buf->st_size = fdata.nFileSizeLow | (((off_t)fdata.nFileSizeHigh)<<32); buf->st_dev = buf->st_rdev = 0; /* not used by Git */ -- cgit v1.2.3-55-g6feb