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 /archival/tar.c | |
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 'archival/tar.c')
-rw-r--r-- | archival/tar.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/archival/tar.c b/archival/tar.c index b9ae93004..54989b953 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -161,7 +161,7 @@ typedef struct TarBallInfo { | |||
161 | # endif | 161 | # endif |
162 | HardLinkInfo *hlInfoHead; /* Hard Link Tracking Information */ | 162 | HardLinkInfo *hlInfoHead; /* Hard Link Tracking Information */ |
163 | HardLinkInfo *hlInfo; /* Hard Link Info for the current file */ | 163 | HardLinkInfo *hlInfo; /* Hard Link Info for the current file */ |
164 | #if !ENABLE_PLATFORM_MINGW32 | 164 | #if !ENABLE_PLATFORM_MINGW32 || ENABLE_FEATURE_EXTRA_FILE_DATA |
165 | //TODO: save only st_dev + st_ino | 165 | //TODO: save only st_dev + st_ino |
166 | struct stat tarFileStatBuf; /* Stat info for the tarball, letting | 166 | struct stat tarFileStatBuf; /* Stat info for the tarball, letting |
167 | * us know the inode and device that the | 167 | * us know the inode and device that the |
@@ -529,7 +529,7 @@ static int FAST_FUNC writeFileToTarball(const char *fileName, struct stat *statb | |||
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | #if !ENABLE_PLATFORM_MINGW32 | 532 | #if !ENABLE_PLATFORM_MINGW32 || ENABLE_FEATURE_EXTRA_FILE_DATA |
533 | /* It is a bad idea to store the archive we are in the process of creating, | 533 | /* It is a bad idea to store the archive we are in the process of creating, |
534 | * so check the device and inode to be sure that this particular file isn't | 534 | * so check the device and inode to be sure that this particular file isn't |
535 | * the new tarball */ | 535 | * the new tarball */ |
@@ -707,7 +707,7 @@ static NOINLINE int writeTarFile( | |||
707 | 707 | ||
708 | /*tbInfo->hlInfoHead = NULL; - already is */ | 708 | /*tbInfo->hlInfoHead = NULL; - already is */ |
709 | 709 | ||
710 | #if !ENABLE_PLATFORM_MINGW32 | 710 | #if !ENABLE_PLATFORM_MINGW32 || ENABLE_FEATURE_EXTRA_FILE_DATA |
711 | /* Store the stat info for the tarball's file, so | 711 | /* Store the stat info for the tarball's file, so |
712 | * can avoid including the tarball into itself.... */ | 712 | * can avoid including the tarball into itself.... */ |
713 | xfstat(tbInfo->tarFd, &tbInfo->tarFileStatBuf, "can't stat tar file"); | 713 | xfstat(tbInfo->tarFd, &tbInfo->tarFileStatBuf, "can't stat tar file"); |