1
1

opal_path_nfs test: do not try to test filesystems that can not be stat'd

Этот коммит содержится в:
Nathan Hjelm 2014-12-05 13:11:32 -07:00
родитель 9cb3e7d181
Коммит 0fc8777aa8

Просмотреть файл

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -13,6 +14,8 @@
* All rights reserved.
* Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010 IBM Corporation. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -27,6 +30,9 @@
#include <stdlib.h>
#include <dirent.h>
#include <sys/param.h>
#include <sys/mount.h>
#include "support.h"
#include "opal/util/path.h"
#include "opal/util/output.h"
@ -129,6 +135,7 @@ void get_mounts (int * num_dirs, char ** dirs[], bool * nfs[])
char ** dirs_tmp;
bool * nfs_tmp;
char buffer[SIZE];
struct statfs statfs;
rc = system (cmd);
@ -137,7 +144,7 @@ void get_mounts (int * num_dirs, char ** dirs[], bool * nfs[])
**dirs = NULL;
*nfs = NULL;
}
dirs_tmp = (char**) malloc (MAX_DIR * sizeof(char**));
dirs_tmp = (char**) calloc (MAX_DIR, sizeof(char**));
nfs_tmp = (bool*) malloc (MAX_DIR * sizeof(bool));
file = fopen("opal_path_nfs.out", "r");
@ -147,7 +154,10 @@ void get_mounts (int * num_dirs, char ** dirs[], bool * nfs[])
int mount_known;
char fs[MAXNAMLEN];
dirs_tmp[i] = malloc (MAXNAMLEN);
if (!dirs_tmp[i]) {
dirs_tmp[i] = malloc (MAXNAMLEN);
}
if (2 != (rc = sscanf (buffer, "%s %s\n", dirs_tmp[i], fs))) {
goto out;
}
@ -173,6 +183,11 @@ void get_mounts (int * num_dirs, char ** dirs[], bool * nfs[])
continue;
}
/* If we can not stat the fs, skip it */
if (statfs (dirs_tmp[i], statfs)) {
continue;
}
/*
* Later mounts override earlier mounts
* (e.g. nfs-mount of /, vs. initial rootfs-mount of /).