bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] fdutimensat: add an atflag parameter


From: Paul Eggert
Subject: Re: [PATCH] fdutimensat: add an atflag parameter
Date: Thu, 16 Sep 2010 16:45:52 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100826 Thunderbird/3.0.7

On 09/16/10 16:28, Eric Blake wrote:
>  int
> -fdutimensat (int dir, char const *file, int fd, struct timespec const ts[2])
> +fdutimensat (int dir, char const *file, int fd, struct timespec const ts[2],
> +             int atflag)
>  {
>    int result = 1;
> +  if (atflag & ~AT_SYMLINK_NOFOLLOW)
> +    {
> +      errno = EINVAL;
> +      return -1;
> +    }
>    if (0 <= fd)
> -    result = futimens (fd, ts);
> +    {
> +      if (atflag)
> +        {
> +          errno = EINVAL;
> +          return -1;
> +        }
> +      result = futimens (fd, ts);
> +    }

Thanks, but unfortunately this doesn't look quite right for GNU tar's purposes.
Tar specifies a nonnegative FD along with a flag equal to AT_SYMLINK_NOFOLLOW.
The idea is that if the underlying system doesn't support futimens
for some reason, tar can still fall back on utimensat, and know
that utimensat won't follow the symlink.

I don't know whether there is any actual system where utimensat works
but futimens doesn't, but I'm pretty sure there is such a problem with
chmod/chown/etc. and I wouldn't be surprised if the problem also existed
with futimens.

If you like, I can install the obvious patch.



reply via email to

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