Re: [parch 2/4] vfs: utimensat(): be consistent with utime() for immutable and append-only files

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

 



> This patch fixes utimensat() to make its behavior consistent
> with that of utime()/utimes() when dealing with files marked
> immutable and append-only.
> 
> The current utimensat() implementation also returns EPERM if
> 'times' is non-NULL and the tv_nsec fields are both UTIME_NOW.
> For consistency, the
> 
> (times != NULL && times[0].tv_nsec == UTIME_NOW &&
>                   times[1].tv_nsec == UTIME_NOW)
> 
> case should be treated like the traditional utimes() case where
> 'times' is NULL.  That is, the call should succeed for a file
> marked append-only and should give the error EACCES if the file
> is marked as immutable.
> 
> The simple way to do this is to set 'times' to NULL
> if (times[0].tv_nsec == UTIME_NOW && times[1].tv_nsec == UTIME_NOW).
> 
> This is also the natural approach, since POSIX.1 semantics consider the
> times == {{x, UTIME_NOW}, {y, UTIME_NOW}}
> to be exactly equivalent to the case for
> times == NULL.
> 
> (Thanks to Miklos for pointing this out.)
> 
> Patch 3 in this series relies on the simplification provided
> by this patch.
> 
> CC: Miklos Szeredi <miklos@xxxxxxxxxx>
> CC: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> CC: Ulrich Drepper <drepper@xxxxxxxxxx>
> Signed-off-by: Michael Kerrisk <mtk.manpages@xxxxxxxxx>

Acked-by: Miklos Szeredi <mszeredi@xxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux