]> git.ipfire.org Git - thirdparty/libvirt.git/commit
vircgroupmock: Mock access() to some more files
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 22 Oct 2013 12:15:21 +0000 (13:15 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 22 Oct 2013 14:42:19 +0000 (15:42 +0100)
commit32799f1a9df649286bb2ac8d5d8edde8e8c4487a
tree36059968b4661962f504ca2f88de74708abc8031
parent9eb68903f5bd60fcbe4f6f416ed0db8088e23c89
vircgroupmock: Mock access() to some more files

Currently, if access(path, mode) is invoked, we check if @path has this
special prefix SYSFS_PREFIX. If it does, we modify the path a bit and
call realaccess. If it doesn't we act just like a wrapper and call
realaccess directly. However, we are mocking fopen() as well. And as one
can clearly see there, fopen("/proc/cgroups") will succeed. Hence, we
have an error in our mocked access(): We need to check whether @path is
not equal to /proc/cgroups as it may not exists on real system we're
running however we definitely know how to fopen() it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tests/vircgroupmock.c