diff options
author | K. Y. Srinivasan <kys@microsoft.com> | 2014-04-10 02:24:16 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-16 23:10:36 +0200 |
commit | 314672a2c2780212fb770bb02d2fffaa1019823f (patch) | |
tree | 779a9ba8840cadcd12fe0c6503b054df61d13aa5 /tools/hv/hv_fcopy_daemon.c | |
parent | vme_tsi148: Utilize to_pci_dev() macro (diff) | |
download | linux-314672a2c2780212fb770bb02d2fffaa1019823f.tar.xz linux-314672a2c2780212fb770bb02d2fffaa1019823f.zip |
Tools: hv: Handle the case when the target file exists correctly
Return the appropriate error code and handle the case when the target
file exists correctly. This fixes a bug.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org> [3.14]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/hv/hv_fcopy_daemon.c')
-rw-r--r-- | tools/hv/hv_fcopy_daemon.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c index 4ecc4fd0bc1b..fba1c75aa484 100644 --- a/tools/hv/hv_fcopy_daemon.c +++ b/tools/hv/hv_fcopy_daemon.c @@ -82,8 +82,10 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg) if (!access(target_fname, F_OK)) { syslog(LOG_INFO, "File: %s exists", target_fname); - if (!smsg->copy_flags & OVER_WRITE) + if (!(smsg->copy_flags & OVER_WRITE)) { + error = HV_ERROR_ALREADY_EXISTS; goto done; + } } target_fd = open(target_fname, O_RDWR | O_CREAT | O_CLOEXEC, 0744); |