#include <config.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
# include "virmock.h"
# include <stdio.h>
# include <stdlib.h>
char *configSrc;
char tmp[256];
struct stat sb;
+ bool configSrcExists = false;
if (VIR_STRDUP_QUIET(id, data->id) < 0)
ABORT_OOM();
if (virFileMakePath(devpath) < 0)
ABORT("Unable to create: %s", devpath);
+ if (real_stat && real_stat(configSrc, &sb) == 0)
+ configSrcExists = true;
+
+# ifdef HAVE___XSTAT
+ if (!configSrcExists &&
+ real___xstat && real___xstat(_STAT_VER, configSrc, &sb) == 0)
+ configSrcExists = true;
+# endif
+
/* If there is a config file for the device within virpcitestdata dir,
* symlink it. Otherwise create a dummy config file. */
- if ((real_stat && real_stat(configSrc, &sb) == 0) ||
- (real___xstat && real___xstat(_STAT_VER, configSrc, &sb) == 0)) {
+ if (configSrcExists) {
/* On success, copy @configSrc into the destination (a copy,
* rather than a symlink, is required since we write into the
* file, and parallel VPATH builds must not stomp on the
return ret;
}
+# ifdef HAVE___LXSTAT
int
__lxstat(int ver, const char *path, struct stat *sb)
{
}
return ret;
}
+# endif /* HAVE___LXSTAT */
int
lstat(const char *path, struct stat *sb)
return ret;
}
+# ifdef HAVE___XSTAT
int
__xstat(int ver, const char *path, struct stat *sb)
{
}
return ret;
}
+# endif /* HAVE___XSTAT */
int
stat(const char *path, struct stat *sb)
return ret;
}
#else
-/* Nothing to override on non-__linux__ platforms */
+/* Nothing to override on this platform */
#endif