X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib_internal%2Funify-copy.c;h=554c0771f1f43d3e26a0d5541dbbd5e077a76bee;hb=b6413ebf89aba05025e97a42b0793c33b859f19f;hp=c67b48e79dfab199c984eb0c847447c524d972e8;hpb=9f52547ae6ad8bde3d17856480453498e4bd0ab1;p=util-vserver.git diff --git a/util-vserver/lib_internal/unify-copy.c b/util-vserver/lib_internal/unify-copy.c index c67b48e..554c077 100644 --- a/util-vserver/lib_internal/unify-copy.c +++ b/util-vserver/lib_internal/unify-copy.c @@ -63,7 +63,7 @@ copyReg(char const *src, struct stat const *src_stat, char const *dst) { int in_fd = open(src, O_RDONLY|O_NOCTTY|O_NONBLOCK|O_NOFOLLOW|O_LARGEFILE); - int out_fd = in_fd==-1 ? -1 : open(dst, O_CREAT|O_EXCL, 0200); + int out_fd = in_fd==-1 ? -1 : open(dst, O_RDWR|O_CREAT|O_EXCL, 0200); bool res = false; if (in_fd==-1 || out_fd==-1 || @@ -74,7 +74,7 @@ copyReg(char const *src, struct stat const *src_stat, ssize_t l = read(in_fd, buf, sizeof buf); if (l==-1) goto err; if (l==0) break; - if (!WwriteAll(out_fd, buf, l, 0)) return false; + if (!WwriteAll(out_fd, buf, l, 0)) goto err; } res = true;