summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-05-08 22:07:35 -0700
committerJeremy Allison <jra@samba.org>2008-05-08 22:07:35 -0700
commit73b65bcd1416cf0f692f861fdb2b92e951f0ea7c (patch)
tree094822b6be5fc1d5d893d4ff6c7016434265d100 /source3/lib
parent00b2cdf75e9bea25034440054b4acd91a179c86d (diff)
downloadsamba-73b65bcd1416cf0f692f861fdb2b92e951f0ea7c.tar.gz
samba-73b65bcd1416cf0f692f861fdb2b92e951f0ea7c.tar.bz2
samba-73b65bcd1416cf0f692f861fdb2b92e951f0ea7c.zip
Fix bug #5452 - smbclient put always creates zero length
files. Thanks to Kai Engert <kengert@redhat.com> for reporting. Jeremy. (This used to be commit 687275cd532f8f8ad710acd222a0c76625da53c6)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/xfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c
index d20a95b03a..e44a92d34d 100644
--- a/source3/lib/xfile.c
+++ b/source3/lib/xfile.c
@@ -263,13 +263,13 @@ int x_fflush(XFILE *f)
if (f->flags & X_FLAG_ERROR) return -1;
+ if (f->bufused == 0 || !f->buf) return 0;
+
if ((f->open_flags & O_ACCMODE) != O_WRONLY) {
errno = EINVAL;
return -1;
}
- if (f->bufused == 0 || !f->buf) return 0;
-
ret = write(f->fd, f->buf, f->bufused);
if (ret == -1) return -1;