diff options
author | Ron Yorston <rmy@pobox.com> | 2019-02-16 12:36:52 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-02-16 12:36:52 +0000 |
commit | d82db8e9a618ddd9a11cc57aff37f687abb0effb (patch) | |
tree | bd072e7344a3c3f0eff553d41c0f154c4470736e /libbb | |
parent | 91e49fbc7b55e8be78ac3ff943e9b7d4494dfe59 (diff) | |
download | busybox-w32-d82db8e9a618ddd9a11cc57aff37f687abb0effb.tar.gz busybox-w32-d82db8e9a618ddd9a11cc57aff37f687abb0effb.tar.bz2 busybox-w32-d82db8e9a618ddd9a11cc57aff37f687abb0effb.zip |
win32: make stat(2) fetch additional metadata
Modify the WIN32 implementation of stat(2) to fetch inode number,
device id and number of hardlinks. This requires opening a handle
to the target file so it will be slower.
A number of features can be enabled or start to work:
- tar can detect if an archive is being stored in itself;
- find can support the -inum and -links options;
- ls can display inode numbers;
- diff can detect attempts to compare a file with itself;
- du has better support for hardlinked files;
- cp can detect attempts to copy a file over itself.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Kbuild.src | 1 | ||||
-rw-r--r-- | libbb/copy_file.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src index b298040ac..799f6d01a 100644 --- a/libbb/Kbuild.src +++ b/libbb/Kbuild.src | |||
@@ -98,6 +98,7 @@ lib-$(CONFIG_PLATFORM_POSIX) += getpty.o | |||
98 | lib-$(CONFIG_PLATFORM_POSIX) += get_volsize.o | 98 | lib-$(CONFIG_PLATFORM_POSIX) += get_volsize.o |
99 | lib-$(CONFIG_PLATFORM_POSIX) += inet_common.o | 99 | lib-$(CONFIG_PLATFORM_POSIX) += inet_common.o |
100 | lib-$(CONFIG_PLATFORM_POSIX) += inode_hash.o | 100 | lib-$(CONFIG_PLATFORM_POSIX) += inode_hash.o |
101 | lib-$(CONFIG_FEATURE_EXTRA_FILE_DATA) += inode_hash.o | ||
101 | lib-$(CONFIG_PLATFORM_POSIX) += kernel_version.o | 102 | lib-$(CONFIG_PLATFORM_POSIX) += kernel_version.o |
102 | lib-$(CONFIG_PLATFORM_POSIX) += login.o | 103 | lib-$(CONFIG_PLATFORM_POSIX) += login.o |
103 | lib-$(CONFIG_PLATFORM_POSIX) += makedev.o | 104 | lib-$(CONFIG_PLATFORM_POSIX) += makedev.o |
diff --git a/libbb/copy_file.c b/libbb/copy_file.c index 299cd7bea..db7a00060 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c | |||
@@ -105,7 +105,7 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags) | |||
105 | return -1; | 105 | return -1; |
106 | } | 106 | } |
107 | } else { | 107 | } else { |
108 | #if !ENABLE_PLATFORM_MINGW32 | 108 | #if !ENABLE_PLATFORM_MINGW32 || ENABLE_FEATURE_EXTRA_FILE_DATA |
109 | /* MinGW does not have inode, and does not use device */ | 109 | /* MinGW does not have inode, and does not use device */ |
110 | if (source_stat.st_dev == dest_stat.st_dev | 110 | if (source_stat.st_dev == dest_stat.st_dev |
111 | && source_stat.st_ino == dest_stat.st_ino | 111 | && source_stat.st_ino == dest_stat.st_ino |