aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2014-01-07 14:43:08 +0000
committerRon Yorston <rmy@pobox.com>2014-01-07 14:43:08 +0000
commit94150aba92d308e417aa552a1b3a957be264b423 (patch)
treed9b570e2641188c68917e85d7cb387fe0bbfbecc /coreutils
parent63b71e4a6f8c65a4bef7617efb50a2b473e388b3 (diff)
downloadbusybox-w32-94150aba92d308e417aa552a1b3a957be264b423.tar.gz
busybox-w32-94150aba92d308e417aa552a1b3a957be264b423.tar.bz2
busybox-w32-94150aba92d308e417aa552a1b3a957be264b423.zip
Revise mingw_stat to minimise changes from upstream BusyBox
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/cp.c4
-rw-r--r--coreutils/libcoreutils/cp_mv_stat.c4
-rw-r--r--coreutils/stat.c8
3 files changed, 1 insertions, 15 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c
index fee82c26b..de2e512be 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
@@ -149,11 +149,7 @@ int cp_main(int argc, char **argv)
149 /* If there are only two arguments and... */ 149 /* If there are only two arguments and... */
150 if (argc == 2) { 150 if (argc == 2) {
151 s_flags = cp_mv_stat2(*argv, &source_stat, 151 s_flags = cp_mv_stat2(*argv, &source_stat,
152#if !ENABLE_PLATFORM_MINGW32
153 (flags & FILEUTILS_DEREFERENCE) ? stat : lstat); 152 (flags & FILEUTILS_DEREFERENCE) ? stat : lstat);
154#else
155 (flags & FILEUTILS_DEREFERENCE) ? mingw_stat : lstat);
156#endif
157 if (s_flags < 0) 153 if (s_flags < 0)
158 return EXIT_FAILURE; 154 return EXIT_FAILURE;
159 d_flags = cp_mv_stat(last, &dest_stat); 155 d_flags = cp_mv_stat(last, &dest_stat);
diff --git a/coreutils/libcoreutils/cp_mv_stat.c b/coreutils/libcoreutils/cp_mv_stat.c
index 6e9fd09f0..5ba07ecc3 100644
--- a/coreutils/libcoreutils/cp_mv_stat.c
+++ b/coreutils/libcoreutils/cp_mv_stat.c
@@ -46,9 +46,5 @@ int FAST_FUNC cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf)
46 46
47int FAST_FUNC cp_mv_stat(const char *fn, struct stat *fn_stat) 47int FAST_FUNC cp_mv_stat(const char *fn, struct stat *fn_stat)
48{ 48{
49#if !ENABLE_PLATFORM_MINGW32
50 return cp_mv_stat2(fn, fn_stat, stat); 49 return cp_mv_stat2(fn, fn_stat, stat);
51#else
52 return cp_mv_stat2(fn, fn_stat, mingw_stat);
53#endif
54} 50}
diff --git a/coreutils/stat.c b/coreutils/stat.c
index e501fb41d..dc9d81c35 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -338,11 +338,7 @@ static void FAST_FUNC print_stat(char *pformat, const char m,
338 printf(pformat, (unsigned long long) statbuf->st_blocks); 338 printf(pformat, (unsigned long long) statbuf->st_blocks);
339 } else if (m == 'o') { 339 } else if (m == 'o') {
340 strcat(pformat, "lu"); 340 strcat(pformat, "lu");
341#if !ENABLE_PLATFORM_MINGW32
342 printf(pformat, (unsigned long) statbuf->st_blksize); 341 printf(pformat, (unsigned long) statbuf->st_blksize);
343#else
344 printf(pformat, (unsigned long) 4096);
345#endif
346 } else if (m == 'x') { 342 } else if (m == 'x') {
347 printfs(pformat, human_time(statbuf->st_atime)); 343 printfs(pformat, human_time(statbuf->st_atime));
348 } else if (m == 'X') { 344 } else if (m == 'X') {
@@ -550,7 +546,6 @@ static bool do_statfs(const char *filename, const char *format)
550static bool do_stat(const char *filename, const char *format) 546static bool do_stat(const char *filename, const char *format)
551{ 547{
552 struct stat statbuf; 548 struct stat statbuf;
553 int status;
554#if ENABLE_SELINUX 549#if ENABLE_SELINUX
555 security_context_t scontext = NULL; 550 security_context_t scontext = NULL;
556 551
@@ -565,8 +560,7 @@ static bool do_stat(const char *filename, const char *format)
565 } 560 }
566 } 561 }
567#endif 562#endif
568 status = option_mask32 & OPT_DEREFERENCE ? stat(filename, &statbuf) : lstat(filename, &statbuf); 563 if ((option_mask32 & OPT_DEREFERENCE ? stat : lstat) (filename, &statbuf) != 0) {
569 if (status != 0) {
570 bb_perror_msg("can't stat '%s'", filename); 564 bb_perror_msg("can't stat '%s'", filename);
571 return 0; 565 return 0;
572 } 566 }