projects
/
2ndquadrant_bdr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8cad3ee
)
bdr: fix open() flags of destination in copy_file()
author
Christoph Moench-Tegeder
<cmt@burggraben.net>
Sun, 15 Mar 2015 22:07:40 +0000
(23:07 +0100)
committer
Christoph Moench-Tegeder
<cmt@burggraben.net>
Sun, 15 Mar 2015 22:07:40 +0000
(23:07 +0100)
- the destination file is not guaranteed to exist, so O_CREAT must be used.
- O_TRUNC has to be set to make sure there will be no leftovers at the end
of the file in case the destination file already existed.
bdr_init_copy.c
patch
|
blob
|
blame
|
history
diff --git
a/bdr_init_copy.c
b/bdr_init_copy.c
index 9041b4aa953f70227a80d384edb3dc23a22ed8a4..e21854ec326fb3e066bf6e2fdcf5aa1f81cc4de2 100644
(file)
--- a/
bdr_init_copy.c
+++ b/
bdr_init_copy.c
@@
-1461,7
+1461,7
@@
copy_file(char *fromfile, char *tofile)
if (srcfd < 0)
die(_("could not open file \"%s\""), fromfile);
- dstfd = open(tofile, O_RDWR | PG_BINARY,
+ dstfd = open(tofile, O_RDWR |
O_CREAT | O_TRUNC |
PG_BINARY,
S_IRUSR | S_IWUSR);
if (dstfd < 0)
die(_("could not create file \"%s\""), tofile);