VFS Linking errors
Jeremy Allison
jra at samba.org
Mon Oct 6 22:53:57 GMT 2008
On Mon, Oct 06, 2008 at 03:09:34PM +0100, Paul Weaver wrote:
> Which seems to call CHECK_STRING_SIZE(d, max_len+1)
>
> d is "d->d_name", with "d" being defined as
> SMB_STRUCT_DIRENT* d = NULL;
> d = SMB_VFS_NEXT_READDIR(handle, dirInfo->dirstream)
>
> And dirInfo is a "mh_dirinfo_struct" defined with
> pstring dirpath
> BOOL isInMediaFiles
> fstring clientMDB
> fstring clientPMR
> fstring clientCreating
> SMB_STRUCT_DIR* dirstream
>
> A bit more DEBUG macros reveals that sizeof(d) is "1" on the 64 bit
> solaris machine, and "256" on my 32 bit linux machine
This is due to the differences in definition. On Linux
it's defined as :
struct dirent {
ino_t d_ino; /* inode number */
off_t d_off; /* offset to the next dirent
*/
unsigned short d_reclen; /* length of this record */
unsigned char d_type; /* type of file */
char d_name[256]; /* filename */
};
On Solaris I'm guessing the last element is :
char d_name[1];
It's really a variable element at the end of the struct,
again from the Linux man pages :
"According to POSIX, the dirent structure contains a field char d_name[]
of unspecified size, with at most NAME_MAX characters preceding the
terminating null byte."
You have to treat the struct accordingly.
> On both the solaris box and the linux SMB_STRUCT_DIRENT is defined as
> dirent64 -- which is a bit confusing at first glance as I've got a 32bit
> linux distro
Not really. Even on 32-bit builds we always use the 64-bit
API's to get the large file (>32bit) code to work correctly.
Jeremy.
More information about the samba-technical
mailing list