nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH 2/2] use futimens() if available, instead of uti


From: Kamil Dudka
Subject: Re: [Nano-devel] [PATCH 2/2] use futimens() if available, instead of utime()
Date: Thu, 04 Feb 2016 00:13:18 +0100
User-agent: KMail/4.14.8 (Linux/4.1.15-gentoo-r1; KDE/4.14.8; x86_64; ; )

On Wednesday, February 03, 2016 13:00:20 Mike Frysinger wrote:
> On 03 Feb 2016 12:32, Kamil Dudka wrote:
> > --- a/trunk/nano/configure.ac
> > +++ b/trunk/nano/configure.ac
> > 
> > -AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp
> > strnlen snprintf vsnprintf) +AC_CHECK_FUNCS(futimens getdelim getline
> > isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf)
> > 
> > --- a/trunk/nano/src/files.c
> > +++ b/trunk/nano/src/files.c
> > @@ -1744,6 +1744,29 @@ int copy_file(FILE *inn, FILE *out)
> > 
> >      return retval;
> >  
> >  }
> > 
> > +#ifdef HAVE_FUTIMENS
> > +/* set atime/mtime by file descriptor */
> > +int utime_wrap(int fd, const char *filename, struct utimbuf *ut)
> > +{
> > +    struct timespec times[2];
> > +    (void) filename;
> > +
> > +    times[0].tv_sec = ut->actime;
> > +    times[1].tv_sec = ut->modtime;
> > +    times[0].tv_nsec = 0L;
> > +    times[1].tv_nsec = 0L;
> > +
> > +    return futimens(fd, times);
> > +}
> > +#else
> > +/* set atime/mtime by file name */
> > +int utime_wrap(int fd, const char *filename, struct utimbuf *ut)
> > +{
> > +    (void) fd;
> > +    return utime(filename, ut);
> > +}
> > +#endif
> 
> nano has grown a lot of custom checks & fallback logic.  at what point
> do we bite the bullet for sanity and switch to gnulib ?  is that now ?
> -mike

I like the idea of starting to use gnulib now.  In my view, it does not
have to be all-or-nothing switch.  We can start with futimens being the
only (directly) imported module of gnulib and import the other modules
later as needed.

Kamil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]