s3: fix calculation of st_blocks in streams_xattr
authorBjörn Jacke <bj@sernet.de>
Wed, 9 Jun 2010 13:24:26 +0000 (15:24 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 11 Jun 2010 07:24:54 +0000 (09:24 +0200)
Thanks to Joachim Schmitz for finding that miscalculation.
(cherry picked from commit 6a6bb768c6542d738a8b2b6da282159a65ed611d)

Fix bug #7503 (vfs_stream_xattr calculates st_blocks wrong).

source3/modules/vfs_streams_xattr.c

index d7c0a834c0038b10db8f7efc659b4bd19b317edf..3f7407a604cb813d02a4e709a4cce912040d9967 100644 (file)
@@ -237,7 +237,7 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
        sbuf->st_ex_ino = stream_inode(sbuf, io->xattr_name);
        sbuf->st_ex_mode &= ~S_IFMT;
         sbuf->st_ex_mode |= S_IFREG;
-        sbuf->st_ex_blocks = sbuf->st_ex_size % STAT_ST_BLOCKSIZE + 1;
+        sbuf->st_ex_blocks = sbuf->st_ex_size / STAT_ST_BLOCKSIZE + 1;
 
        return 0;
 }
@@ -290,7 +290,7 @@ static int streams_xattr_stat(vfs_handle_struct *handle,
        smb_fname->st.st_ex_mode &= ~S_IFMT;
         smb_fname->st.st_ex_mode |= S_IFREG;
         smb_fname->st.st_ex_blocks =
-           smb_fname->st.st_ex_size % STAT_ST_BLOCKSIZE + 1;
+           smb_fname->st.st_ex_size / STAT_ST_BLOCKSIZE + 1;
 
        result = 0;
  fail:
@@ -341,7 +341,7 @@ static int streams_xattr_lstat(vfs_handle_struct *handle,
        smb_fname->st.st_ex_mode &= ~S_IFMT;
         smb_fname->st.st_ex_mode |= S_IFREG;
         smb_fname->st.st_ex_blocks =
-           smb_fname->st.st_ex_size % STAT_ST_BLOCKSIZE + 1;
+           smb_fname->st.st_ex_size / STAT_ST_BLOCKSIZE + 1;
 
        result = 0;