Subject: Re: [PATCH] preserve mtime of local clone

From: Clemens Buchacher <[email-masked]>
Date: Sat, 12 Sep 2009 10:26:24 +0200

On Fri, Sep 11, 2009 at 10:09:12PM -0700, Junio C Hamano wrote:
> Clemens Buchacher <[email-masked]> writes:
> 
> > +int copy_times(int ofd, int ifd)
> > +{
> > +	struct stat st;
> > +	struct timespec times[2];
> > +	if (fstat(ifd, &st))
> > +		return -1;
> > +	times[0].tv_nsec = UTIME_OMIT;
> > +	times[1].tv_sec = st.st_mtime;
> > +	times[1].tv_nsec = ST_MTIME_NSEC(st);
> > +	return futimens(ofd, times);
> > +}
> 
> Hmm, futimens() is relatively new.  Are minority platforms folks Ok with
> this patch?
> 
> At least SunOS 5.11 (OpenSolaris 0811) seems to barf on UTIME_OMIT.

If it's a problem we can use utime() instead. I was just trying to use the
file descriptors, since they were available. But the patch would be a little
smaller if I didn't touch copy_fd().

Clemens