mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-08-03 18:05:58 -04:00
Merge pull request #288 from cptpcrd/utimensat-fix
Fix flaws in utimensat() handling
This commit is contained in:
commit
af5cb1c04c
22
main.c
22
main.c
@ -3947,19 +3947,23 @@ ovl_setattr (fuse_req_t req, fuse_ino_t ino, struct stat *attr, int to_set, stru
|
|||||||
l = release_big_lock ();
|
l = release_big_lock ();
|
||||||
|
|
||||||
memset (times, 0, sizeof (times));
|
memset (times, 0, sizeof (times));
|
||||||
times[0].tv_sec = UTIME_OMIT;
|
times[0].tv_nsec = UTIME_OMIT;
|
||||||
times[1].tv_sec = UTIME_OMIT;
|
times[1].tv_nsec = UTIME_OMIT;
|
||||||
if (to_set & FUSE_SET_ATTR_ATIME)
|
if (to_set & FUSE_SET_ATTR_ATIME)
|
||||||
times[0] = attr->st_atim;
|
{
|
||||||
else if (to_set & FUSE_SET_ATTR_ATIME_NOW)
|
times[0] = attr->st_atim;
|
||||||
times[0].tv_sec = UTIME_NOW;
|
if (to_set & FUSE_SET_ATTR_ATIME_NOW)
|
||||||
|
times[0].tv_nsec = UTIME_NOW;
|
||||||
|
}
|
||||||
|
|
||||||
if (to_set & FUSE_SET_ATTR_MTIME)
|
if (to_set & FUSE_SET_ATTR_MTIME)
|
||||||
times[1] = attr->st_mtim;
|
{
|
||||||
else if (to_set & FUSE_SET_ATTR_MTIME_NOW)
|
times[1] = attr->st_mtim;
|
||||||
times[1].tv_sec = UTIME_NOW;
|
if (to_set & FUSE_SET_ATTR_MTIME_NOW)
|
||||||
|
times[1].tv_nsec = UTIME_NOW;
|
||||||
|
}
|
||||||
|
|
||||||
if (times[0].tv_sec != UTIME_OMIT || times[1].tv_sec != UTIME_OMIT)
|
if (times[0].tv_nsec != UTIME_OMIT || times[1].tv_nsec != UTIME_OMIT)
|
||||||
{
|
{
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
ret = futimens (fd, times);
|
ret = futimens (fd, times);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user