Bug 550 - st_blocks and st_blksize used unconditionaly
Summary: st_blocks and st_blksize used unconditionaly
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.0
Hardware: Other other
: P3 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-01 04:04 UTC by Joachim Schmitz (mail address dead)
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 (mail address dead) 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 (dead mail address) 2003-10-01 09:54:46 UTC
Applied.  cvs checkin coming soon.
Comment 2 Gerald (Jerry) Carter (dead mail address) 2003-10-01 09:58:53 UTC
forgot to mark as fixed.
Comment 3 Joachim Schmitz (mail address dead) 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 (dead mail address) 2005-08-24 10:15:57 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.