提交 598641f4 编写于 作者: D Daniel P. Berrangé

tests: don't abort in fopen(/proc/mounts)

The mock fopen() function will abort if "/proc/mounts" is
requested with "r" permissions and VIR_CGROUP_MOCK_FILENAME
env var is not set.

Unfortunately this is triggering by the libselinux library
constructor when it tries to read /proc/mounts to find out
if selinuxfs is mounted in an unusual place.

This, however, only affects libselinux in Debian as that
opens with "r", while in Fedora / RHEL it opens "re" and
thus luckily never triggered the abort(), instead getting
an EACCESS.
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 a6d822ce
......@@ -460,8 +460,10 @@ FILE *fopen(const char *path, const char *mode)
}
if (type) {
if (!filename)
abort();
if (!filename) {
errno = EACCES;
return NULL;
}
if (virAsprintfQuiet(&filepath, "%s/vircgroupdata/%s.%s",
abs_srcdir, filename, type) < 0) {
abort();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册