[Samba] Windows API SetFileTime sets mtime and atime as the same

Hui Wang hui.wang.1980 at gmail.com
Wed Sep 6 06:17:23 GMT 2006


Hello Everyone,

I think i found something not very right in "smbd/dosmode.c". When I use
SetFileTime to adjust mtime and atime for files, and the result always leads
to update the mtime and atime to the same value.

After some investigation, I found the issue is cause by
smbd/dosmode.c:set_filetime function, the related codes goes below,

        struct utimbuf times;

        if (null_mtime(mtime))
                return(True);

!!        times.modtime = times.actime = mtime;

        if (file_utime(conn, fname, &times)) {
                DEBUG(4,("set_filetime(%s) failed:
%s\n",fname,strerror(errno)));
                return False;
        }

        return(True);

the line marked with !! shows that smbd will always set modtime and actime
as the same value before calling utime to update file, this is even true
with 3.0.23c src. I guess I should not be the 1st person who came into this.
I wish somebody could tell me how to make SetFileTime work with samba, or
any workround to make atime separately is also welcome.

Nelson


More information about the samba mailing list