diff options
author | Ron Yorston <rmy@pobox.com> | 2012-11-29 10:12:11 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-11-29 10:12:11 +0000 |
commit | 45c0070a259132f13424ba2ff42ea523c4fd318a (patch) | |
tree | dc1b443f039a47eb27c80690346ccc7dce10dcd1 /libbb | |
parent | 0528a8658d7237f4bac0d853db51028036f6a650 (diff) | |
download | busybox-w32-45c0070a259132f13424ba2ff42ea523c4fd318a.tar.gz busybox-w32-45c0070a259132f13424ba2ff42ea523c4fd318a.tar.bz2 busybox-w32-45c0070a259132f13424ba2ff42ea523c4fd318a.zip |
Ensure mingw_stat is called when necessary
In some cases a funtion pointer to the stat function is used.
The preprocessor can't replace these with the mingw_stat, so
make alternative arrangements in those cases.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/copy_file.c | 4 | ||||
-rw-r--r-- | libbb/recursive_action.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c index be65c4b47..7da31f69d 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c | |||
@@ -81,11 +81,13 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags) | |||
81 | smallint retval = 0; | 81 | smallint retval = 0; |
82 | smallint dest_exists = 0; | 82 | smallint dest_exists = 0; |
83 | smallint ovr; | 83 | smallint ovr; |
84 | int status; | ||
84 | 85 | ||
85 | /* Inverse of cp -d ("cp without -d") */ | 86 | /* Inverse of cp -d ("cp without -d") */ |
86 | #define FLAGS_DEREF (flags & (FILEUTILS_DEREFERENCE + FILEUTILS_DEREFERENCE_L0)) | 87 | #define FLAGS_DEREF (flags & (FILEUTILS_DEREFERENCE + FILEUTILS_DEREFERENCE_L0)) |
87 | 88 | ||
88 | if ((FLAGS_DEREF ? stat : lstat)(source, &source_stat) < 0) { | 89 | status = FLAGS_DEREF ? stat(source, &source_stat) : lstat(source, &source_stat); |
90 | if (status < 0) { | ||
89 | /* This may be a dangling symlink. | 91 | /* This may be a dangling symlink. |
90 | * Making [sym]links to dangling symlinks works, so... */ | 92 | * Making [sym]links to dangling symlinks works, so... */ |
91 | if (flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) | 93 | if (flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) |
diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c index b5cf7c0ab..7ec3a1443 100644 --- a/libbb/recursive_action.c +++ b/libbb/recursive_action.c | |||
@@ -73,7 +73,7 @@ int FAST_FUNC recursive_action(const char *fileName, | |||
73 | if (depth == 0) | 73 | if (depth == 0) |
74 | follow = ACTION_FOLLOWLINKS | ACTION_FOLLOWLINKS_L0; | 74 | follow = ACTION_FOLLOWLINKS | ACTION_FOLLOWLINKS_L0; |
75 | follow &= flags; | 75 | follow &= flags; |
76 | status = (follow ? stat : lstat)(fileName, &statbuf); | 76 | status = follow ? stat(fileName, &statbuf) : lstat(fileName, &statbuf); |
77 | if (status < 0) { | 77 | if (status < 0) { |
78 | #ifdef DEBUG_RECURS_ACTION | 78 | #ifdef DEBUG_RECURS_ACTION |
79 | bb_error_msg("status=%d flags=%x", status, flags); | 79 | bb_error_msg("status=%d flags=%x", status, flags); |