diff options
author | Ting-Chang Hou <tchou@synology.com> | 2018-04-18 15:12:15 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-06-07 16:37:38 +0200 |
commit | 6c817a1e6aff223d264e24dd5953622bdf2d32ad (patch) | |
tree | 814909eb2ffb41631e29e222aee09fb677a1a746 /cmds-restore.c | |
parent | 22bd1d5e352aef3e0a92fe683471c4768b321e50 (diff) |
btrfs-progs: restore: fix mistake on overwrite_ok() if relative path is given
fstatat will return -1 with errno EBADF if path_name is relative path.
This caused an error of the return value of overwrite_ok().
When restoring the subvolume to destination with relative path,
it will overwrite the existing file rather than skip it.
Signed-off-by: tchou <tchou@synology.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-restore.c')
-rw-r--r-- | cmds-restore.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds-restore.c b/cmds-restore.c index f228acab..342f5cc7 100644 --- a/cmds-restore.c +++ b/cmds-restore.c @@ -825,7 +825,7 @@ static int overwrite_ok(const char * path) int ret; /* don't be fooled by symlinks */ - ret = fstatat(-1, path_name, &st, AT_SYMLINK_NOFOLLOW); + ret = fstatat(AT_FDCWD, path_name, &st, AT_SYMLINK_NOFOLLOW); if (!ret) { if (overwrite) |