diff options
author | Rajesh Joseph <rjoseph@redhat.com> | 2015-09-09 17:46:16 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2015-09-22 10:35:51 -0700 |
commit | 59557e1c9ca33c997743c0c03cf73c2f470c8bf3 (patch) | |
tree | 05ca2d01b95e6c2f721e992c375d9a632480f0ff /xlators/mgmt | |
parent | 68e8d617eb62a7ec40a1db5f3f60730767a168b6 (diff) |
glusterd/utils: glusterd_copy_file does not truncate target file
glusterd_copy_file function copies source file to target. If
the target file already exists and is bigger than the source
file then it can cause file corruption.
Target file should be truncated before copying source content.
Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Change-Id: Ie973f3e9fa06309ded6f69dcde41e1b60b3e028e
BUG: 1261482
Reviewed-on: http://review.gluster.org/12141
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index 23fae9add57..5833e5ec593 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -3234,7 +3234,7 @@ glusterd_copy_file (const char *source, const char *destination) goto out; } - dest_fd = open (destination, O_CREAT | O_RDWR, dest_mode); + dest_fd = creat (destination, dest_mode); if (dest_fd < 0) { ret = -1; gf_msg (this->name, GF_LOG_ERROR, 0, |