The use of 'stat' in nodeDeviceVportCreateDelete is only to check
if the file exists or not, it's a bit overkill, and safe to replace
with the wrapper of access(2) (virFileExists).
#include <errno.h>
#include <fcntl.h>
#include <time.h>
-#include <sys/stat.h>
#include "virerror.h"
#include "datatypes.h"
int retval = 0;
char *operation_path = NULL, *vport_name = NULL;
const char *operation_file = NULL;
- struct stat st;
switch (operation) {
case VPORT_CREATE:
goto cleanup;
}
- if (stat(operation_path, &st) != 0) {
+ if (!virFileExists(operation_path)) {
VIR_FREE(operation_path);
if (virAsprintf(&operation_path,
"%shost%d%s",
goto cleanup;
}
- if (stat(operation_path, &st) != 0) {
+ if (!virFileExists(operation_path)) {
VIR_ERROR(_("No vport operation path found for host%d"),
parent_host);
retval = -1;