There are no guarantees that fstatat() does not clobber the stat
buffer on errors.
Use a temporary buffer so that the following code sees correct
attributes of the source entry.
Issue #973
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
{
int err = 0;
struct stat sb;
+ struct stat tmp_sb;
struct link_name *lp;
struct timespec mt[2];
* If the destination already exists do nothing.
* This is after the copy_dir above to still iterate into subdirectories.
*/
- if (fstatat(dst->dirfd, dst->name, &sb, AT_SYMLINK_NOFOLLOW) != -1) {
+ if (fstatat(dst->dirfd, dst->name, &tmp_sb, AT_SYMLINK_NOFOLLOW) != -1) {
return err;
}