[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: |
Mike Frysinger |
Subject: |
Re: [Nano-devel] [PATCH 2/2] use futimens() if available, instead of utime() |
Date: |
Wed, 3 Feb 2016 13:00:20 -0500 |
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
signature.asc
Description: Digital signature
- [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 <=
- Re: [Nano-devel] [PATCH 2/2] use futimens() if available, instead of utime(), Kamil Dudka, 2016/02/03
- [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