aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-03-12 14:57:27 +0000
committerRon Yorston <rmy@pobox.com>2019-03-12 14:57:27 +0000
commit8fd0fda31a51bbc10caea9dd6a209012e1a21172 (patch)
tree2f4365bcaf3daa0f3096f1a9550309def0324289
parent0a058590010129557bdb9abd26d338297a21f10e (diff)
downloadbusybox-w32-8fd0fda31a51bbc10caea9dd6a209012e1a21172.tar.gz
busybox-w32-8fd0fda31a51bbc10caea9dd6a209012e1a21172.tar.bz2
busybox-w32-8fd0fda31a51bbc10caea9dd6a209012e1a21172.zip
win32: consolidate file metadata options
Merge FEATURE_IDENTIFY_OWNER into FEATURE_EXTRA_FILE_DATA.
-rw-r--r--Config.in14
-rw-r--r--configs/mingw32_defconfig1
-rw-r--r--configs/mingw64_defconfig1
-rw-r--r--win32/mingw.c10
4 files changed, 6 insertions, 20 deletions
diff --git a/Config.in b/Config.in
index 100f6e491..33365d21c 100644
--- a/Config.in
+++ b/Config.in
@@ -456,22 +456,16 @@ config FEATURE_EURO
456 the console is 850 when BusyBox starts it's changed to 858. 456 the console is 850 when BusyBox starts it's changed to 858.
457 457
458config FEATURE_EXTRA_FILE_DATA 458config FEATURE_EXTRA_FILE_DATA
459 bool "Read additional file metadata (1.3 kb)" 459 bool "Read additional file metadata (2.1 kb)"
460 default y 460 default y
461 depends on PLATFORM_MINGW32 461 depends on PLATFORM_MINGW32
462 help 462 help
463 Read additional file metadata: device id, inode number and number 463 Read additional file metadata: device id, inode number and number
464 of hard links. This may slow down some file operations but it 464 of hard links. This may slow down some file operations but it
465 permits extra features such as warning of attempts to copy a file 465 permits extra features such as warning of attempts to copy a file
466 onto itself or to store a tar archive in itself. 466 onto itself or to store a tar archive in itself. Also try to
467 467 determine the ownership of files so that, for example, 'ls' can
468config FEATURE_IDENTIFY_OWNER 468 distinguish files belonging to the current user.
469 bool "Check whether files belong to current user (0.6 kb)"
470 default y
471 depends on FEATURE_EXTRA_FILE_DATA
472 help
473 Try to determine if files belong to the current user. If they don't
474 they're listed as belonging to root.
475 469
476config FEATURE_READLINK2 470config FEATURE_READLINK2
477 bool "Read the contents of symbolic links (1.1 kb)" 471 bool "Read the contents of symbolic links (1.1 kb)"
diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig
index 571aa112c..d7a32e53f 100644
--- a/configs/mingw32_defconfig
+++ b/configs/mingw32_defconfig
@@ -49,7 +49,6 @@ CONFIG_FEATURE_ICON=y
49CONFIG_FEATURE_ICON_ALL=y 49CONFIG_FEATURE_ICON_ALL=y
50CONFIG_FEATURE_EURO=y 50CONFIG_FEATURE_EURO=y
51CONFIG_FEATURE_EXTRA_FILE_DATA=y 51CONFIG_FEATURE_EXTRA_FILE_DATA=y
52CONFIG_FEATURE_IDENTIFY_OWNER=y
53CONFIG_FEATURE_READLINK2=y 52CONFIG_FEATURE_READLINK2=y
54 53
55# 54#
diff --git a/configs/mingw64_defconfig b/configs/mingw64_defconfig
index 47bfc994a..98317c358 100644
--- a/configs/mingw64_defconfig
+++ b/configs/mingw64_defconfig
@@ -49,7 +49,6 @@ CONFIG_FEATURE_ICON=y
49CONFIG_FEATURE_ICON_ALL=y 49CONFIG_FEATURE_ICON_ALL=y
50CONFIG_FEATURE_EURO=y 50CONFIG_FEATURE_EURO=y
51CONFIG_FEATURE_EXTRA_FILE_DATA=y 51CONFIG_FEATURE_EXTRA_FILE_DATA=y
52CONFIG_FEATURE_IDENTIFY_OWNER=y
53CONFIG_FEATURE_READLINK2=y 52CONFIG_FEATURE_READLINK2=y
54 53
55# 54#
diff --git a/win32/mingw.c b/win32/mingw.c
index 84b059506..c04cc4872 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -1,7 +1,7 @@
1#include "libbb.h" 1#include "libbb.h"
2#include <userenv.h> 2#include <userenv.h>
3#include "lazyload.h" 3#include "lazyload.h"
4#if ENABLE_FEATURE_IDENTIFY_OWNER 4#if ENABLE_FEATURE_EXTRA_FILE_DATA
5#include <aclapi.h> 5#include <aclapi.h>
6#endif 6#endif
7#if ENABLE_FEATURE_READLINK2 7#if ENABLE_FEATURE_READLINK2
@@ -401,7 +401,7 @@ static int has_exec_format(const char *name)
401 return 0; 401 return 0;
402} 402}
403 403
404#if ENABLE_FEATURE_IDENTIFY_OWNER 404#if ENABLE_FEATURE_EXTRA_FILE_DATA
405static uid_t file_owner(HANDLE fh) 405static uid_t file_owner(HANDLE fh)
406{ 406{
407 PSID pSidOwner; 407 PSID pSidOwner;
@@ -553,12 +553,8 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf)
553 flags = FILE_FLAG_BACKUP_SEMANTICS; 553 flags = FILE_FLAG_BACKUP_SEMANTICS;
554 if (S_ISLNK(buf->st_mode)) 554 if (S_ISLNK(buf->st_mode))
555 flags |= FILE_FLAG_OPEN_REPARSE_POINT; 555 flags |= FILE_FLAG_OPEN_REPARSE_POINT;
556#if ENABLE_FEATURE_IDENTIFY_OWNER
557 fh = CreateFile(file_name, READ_CONTROL, 0, NULL, 556 fh = CreateFile(file_name, READ_CONTROL, 0, NULL,
558 OPEN_EXISTING, flags, NULL); 557 OPEN_EXISTING, flags, NULL);
559#else
560 fh = CreateFile(file_name, 0, 0, NULL, OPEN_EXISTING, flags, NULL);
561#endif
562 if (fh != INVALID_HANDLE_VALUE) { 558 if (fh != INVALID_HANDLE_VALUE) {
563 if (GetFileInformationByHandle(fh, &hdata)) { 559 if (GetFileInformationByHandle(fh, &hdata)) {
564 buf->st_dev = hdata.dwVolumeSerialNumber; 560 buf->st_dev = hdata.dwVolumeSerialNumber;
@@ -567,9 +563,7 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf)
567 buf->st_nlink = S_ISDIR(buf->st_mode) ? 2 : 563 buf->st_nlink = S_ISDIR(buf->st_mode) ? 2 :
568 hdata.nNumberOfLinks; 564 hdata.nNumberOfLinks;
569 } 565 }
570#if ENABLE_FEATURE_IDENTIFY_OWNER
571 buf->st_uid = buf->st_gid = file_owner(fh); 566 buf->st_uid = buf->st_gid = file_owner(fh);
572#endif
573 CloseHandle(fh); 567 CloseHandle(fh);
574 } 568 }
575 else { 569 else {