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: 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

Attachment: signature.asc
Description: Digital signature


reply via email to

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