From: Michal Privoznik Date: Mon, 6 May 2019 14:11:57 +0000 (+0200) Subject: virtestmock: Initialize symbols from stat() and its friends X-Git-Tag: v5.4.0-rc1~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1de5dd2ba6e05e1825f72ccf4f25bab0227fb24;p=thirdparty%2Flibvirt.git virtestmock: Initialize symbols from stat() and its friends Introduced by ff376c6283c97. Previously, init_syms() was called from stat() mock and its friends. This is crucial because checkPath() might call printFile() which in turn calls real_fopen(). But if stat() or one of its friends is the first function called then because of lacking init_syms() call no real_* is initialized. The other thing is that we really want the recorded action to be "stat" instead of __FUNCTION__ because there's no good in recording that it was __xstat64 who touched some file. Signed-off-by: Michal Privoznik --- diff --git a/tests/virtestmock.c b/tests/virtestmock.c index bc62312444..df8cac6441 100644 --- a/tests/virtestmock.c +++ b/tests/virtestmock.c @@ -190,7 +190,11 @@ int access(const char *path, int mode) } -#define VIR_MOCK_STAT_HOOK CHECK_PATH(path) +#define VIR_MOCK_STAT_HOOK \ + do { \ + init_syms(); \ + checkPath(path, "stat"); \ + } while (0) #include "virmockstathelpers.c"