diff options
author | Ron Yorston <rmy@pobox.com> | 2018-04-10 21:52:58 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-04-10 21:52:58 +0100 |
commit | 0038f9d39a306c3c7860756f03102de217dc5cd9 (patch) | |
tree | 4ce098f303e70d397d31683bdd37874a87b817b5 /coreutils/stat.c | |
parent | 072edb130eaabd50961df71156c3ca7d0773d690 (diff) | |
download | busybox-w32-0038f9d39a306c3c7860756f03102de217dc5cd9.tar.gz busybox-w32-0038f9d39a306c3c7860756f03102de217dc5cd9.tar.bz2 busybox-w32-0038f9d39a306c3c7860756f03102de217dc5cd9.zip |
ls, stat: don't try to read symlinks
Currently the WIN32 emulation of readlink(2) fails with ENOSYS.
This causes ugly error messages in ls and stat.
Don't even try calling readlink(2) and skip any code that uses
the name it doesn't return.
Diffstat (limited to 'coreutils/stat.c')
-rw-r--r-- | coreutils/stat.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c index 2944cdfcb..43fad2324 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -317,6 +317,7 @@ static void FAST_FUNC print_stat(char *pformat, const char m, | |||
317 | printfs(pformat, filename); | 317 | printfs(pformat, filename); |
318 | } else if (m == 'N') { | 318 | } else if (m == 'N') { |
319 | strcatc(pformat, 's'); | 319 | strcatc(pformat, 's'); |
320 | #if !ENABLE_PLATFORM_MINGW32 | ||
320 | if (S_ISLNK(statbuf->st_mode)) { | 321 | if (S_ISLNK(statbuf->st_mode)) { |
321 | char *linkname = xmalloc_readlink_or_warn(filename); | 322 | char *linkname = xmalloc_readlink_or_warn(filename); |
322 | if (linkname == NULL) | 323 | if (linkname == NULL) |
@@ -326,6 +327,9 @@ static void FAST_FUNC print_stat(char *pformat, const char m, | |||
326 | } else { | 327 | } else { |
327 | printf(pformat, filename); | 328 | printf(pformat, filename); |
328 | } | 329 | } |
330 | #else | ||
331 | printf(pformat, filename); | ||
332 | #endif | ||
329 | } else if (m == 'd') { | 333 | } else if (m == 'd') { |
330 | strcat(pformat, "llu"); | 334 | strcat(pformat, "llu"); |
331 | printf(pformat, (unsigned long long) statbuf->st_dev); | 335 | printf(pformat, (unsigned long long) statbuf->st_dev); |
@@ -708,6 +712,7 @@ static bool do_stat(const char *filename, const char *format) | |||
708 | gw_ent = getgrgid(statbuf.st_gid); | 712 | gw_ent = getgrgid(statbuf.st_gid); |
709 | pw_ent = getpwuid(statbuf.st_uid); | 713 | pw_ent = getpwuid(statbuf.st_uid); |
710 | 714 | ||
715 | #if !ENABLE_PLATFORM_MINGW32 | ||
711 | if (S_ISLNK(statbuf.st_mode)) | 716 | if (S_ISLNK(statbuf.st_mode)) |
712 | linkname = xmalloc_readlink_or_warn(filename); | 717 | linkname = xmalloc_readlink_or_warn(filename); |
713 | if (linkname) { | 718 | if (linkname) { |
@@ -716,6 +721,9 @@ static bool do_stat(const char *filename, const char *format) | |||
716 | } else { | 721 | } else { |
717 | printf(" File: '%s'\n", filename); | 722 | printf(" File: '%s'\n", filename); |
718 | } | 723 | } |
724 | #else | ||
725 | printf(" File: '%s'\n", filename); | ||
726 | #endif | ||
719 | 727 | ||
720 | printf(" Size: %-10llu\tBlocks: %-10llu IO Block: %-6lu %s\n" | 728 | printf(" Size: %-10llu\tBlocks: %-10llu IO Block: %-6lu %s\n" |
721 | "Device: %llxh/%llud\tInode: %-10llu Links: %-5lu", | 729 | "Device: %llxh/%llud\tInode: %-10llu Links: %-5lu", |