[PATCH] Fix bug 9777 - vfs_dirsort uses non-stackable calls, dirfd(), malloc instead of talloc and doesn't cope with directories being modified whilst reading.

Jeremy Allison jra at samba.org
Thu Apr 11 10:41:26 MDT 2013


On Thu, Apr 11, 2013 at 09:40:33AM -0700, Jeremy Allison wrote:
> 
> The reason I use a pointer here is that I don't
> want to modify *ret_mtime unless I know the
> stat returned 0.
> 
> So if I have :
> 
> +     struct timespec mtime;
> +
> +     if (data->fsp) {
> +             ret = fsp_stat(data->fsp);
> +             mtime = &data->fsp->fsp_name->st.st_ex_mtime;
                        ^
			Without the '&', obviously :-).
> +     } else {
> +             ret = SMB_VFS_STAT(handle->conn, data->smb_fname);
> +             mtime = &data->smb_fname->st.st_ex_mtime;
                        ^
			Without the '&', obviously :-).
> +     }
> ..
> +     *ret_mtime = mtime;
> 
> That is 2 structure copies rather than one. But I
> suppose as an st.st_ex_mtime is 8 bytes, and on a
> 64-bit box a pointer assignment is also 8 bytes
> then it doesn't really make a difference :-).
> 
> > The rest looks fine to me.
> 
> Thanks ! I'll add your reviewed-by and push.
> 
> Jeremy.


More information about the samba-technical mailing list