Bug 550 - st_blocks and st_blksize used unconditionaly
st_blocks and st_blksize used unconditionaly
Status: CLOSED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: Build environment
3.0.0
Other other
: P3 normal
: none
Assigned To: Tim Potter
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-10-01 04:04 UTC by Joachim Schmitz
Modified: 2005-08-24 10:15 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Schmitz 2003-10-01 04:04:21 UTC
Hi there

st_blocks and st_blksize are used unconditionaly:

--- source/libsmb/libsmbclient.c.orig   2003-06-07 19:57:33.000000000 +0200
+++ source/libsmb/libsmbclient.c        2003-10-01 12:55:41.000000000 +0200
@@ -1139,8 +1139,12 @@
        if (!IS_DOS_READONLY(mode)) st->st_mode |= S_IWUSR;

        st->st_size = size;
+#ifdef HAVE_STAT_ST_BLKSIZE
        st->st_blksize = 512;
+#endif
+#ifdef HAVE_STAT_ST_BLOCKS
        st->st_blocks = (size+511)/512;
+#endif
        st->st_uid = getuid();
        st->st_gid = getgid();

--- source/smbd/dosmode.c.orig  2003-06-07 19:57:39.000000000 +0200
+++ source/smbd/dosmode.c       2003-10-01 12:58:23.000000000 +0200
@@ -136,9 +136,11 @@
        if (S_ISDIR(sbuf->st_mode))
                result = aDIR | (result & aRONLY);

+#if defined (HAVE_STAT_ST_BLOCKS) && defined (HAVE_STAT_ST_BLKSIZE)
        if (sbuf->st_size > sbuf->st_blocks * (SMB_OFF_T)sbuf->st_blksize) {
                result |= FILE_ATTRIBUTE_SPARSE;
        }
+#endif

 #ifdef S_ISLNK
 #if LINKS_READ_ONLY



Bye, Jojo
Comment 1 Gerald (Jerry) Carter 2003-10-01 09:54:46 UTC
Applied.  cvs checkin coming soon.
Comment 2 Gerald (Jerry) Carter 2003-10-01 09:58:53 UTC
forgot to mark as fixed.
Comment 3 Joachim Schmitz 2003-10-08 03:18:37 UTC
Hi there

Ptach hasn't yet shown up in CVS, neither in Samba 3.0 nor in Samba HEAD

Bye, Jojo
Comment 4 Tim Potter 2003-10-13 20:56:35 UTC
Really checked in this time.  I found a few more instances of these two members
being used unconditionally and fixed them too.
Comment 5 Gerald (Jerry) Carter 2005-08-24 10:15:57 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.