summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
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;