aboutsummaryrefslogtreecommitdiff
path: root/libbb/copy_file.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-11-29 10:12:11 +0000
committerRon Yorston <rmy@pobox.com>2012-11-29 10:12:11 +0000
commit45c0070a259132f13424ba2ff42ea523c4fd318a (patch)
treedc1b443f039a47eb27c80690346ccc7dce10dcd1 /libbb/copy_file.c
parent0528a8658d7237f4bac0d853db51028036f6a650 (diff)
downloadbusybox-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/copy_file.c')
-rw-r--r--libbb/copy_file.c4
1 files changed, 3 insertions, 1 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))