]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix bug #5452 - smbclient put always creates zero length
authorJeremy Allison <jra@samba.org>
Fri, 9 May 2008 05:07:27 +0000 (22:07 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 9 May 2008 05:07:27 +0000 (22:07 -0700)
files. Thanks to Kai Engert <kengert@redhat.com> for
reporting.
Karolin - this is a showstopper and must be pulled
into 3.2-stable. Thanks !
Jeremy.

source/lib/xfile.c

index d20a95b03a38f3c6fb9ddfab037232666a07bd91..e44a92d34dcb79b83f90c6bde687839cc2d90d39 100644 (file)
@@ -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;