mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
qemusecuritymock: Fix bit arithmetic
One of the functions of this mock is that it spoofs chown() and stat() calls. But it is doing so in a clever way: it stores the new owner on chown() and reports it on subsequent stat(). This is done by using a 32bit unsigned integer where one half is used to store uid the other is for gid. Later, when stat() is called the integer is fetched and split into halves again. Well, my bit operation skills are poor and the code I've written does not do that properly. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
0a9dcfabf8
commit
854f0e85e4
@ -226,7 +226,7 @@ int virFileRemoveXAttr(const char *path,
|
||||
sb->st_gid = DEFAULT_GID; \
|
||||
} else { \
|
||||
/* Known path. Set values passed to chown() earlier */ \
|
||||
sb->st_uid = *val % 16; \
|
||||
sb->st_uid = *val & 0xffff; \
|
||||
sb->st_gid = *val >> 16; \
|
||||
} \
|
||||
\
|
||||
|
Loading…
Reference in New Issue
Block a user