[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
- [Nano-devel] [PATCH 1/2] check stat's result and avoid calling stat on a NULL pointer, Kamil Dudka, 2016/02/03
- [Nano-devel] [PATCH 2/2] use futimens() if available, instead of utime(), Kamil Dudka, 2016/02/03
- Re: [Nano-devel] [PATCH 2/2] use futimens() if available, instead of utime(), Mike Frysinger, 2016/02/03
- Re: [Nano-devel] [PATCH 2/2] use futimens() if available, instead of utime(),
Kamil Dudka <=
- [Nano-devel] begin using gnulib?, Benno Schulenberg, 2016/02/04
- Re: [Nano-devel] begin using gnulib?, Mike Frysinger, 2016/02/04
- Re: [Nano-devel] begin using gnulib?, Chris Allegretta, 2016/02/05
- Re: [Nano-devel] begin using gnulib?, Kamil Dudka, 2016/02/05
Re: [Nano-devel] [PATCH 1/2] check stat's result and avoid calling stat on a NULL pointer, Benno Schulenberg, 2016/02/06