Commit 5bf35a7a authored by Shane Snyder's avatar Shane Snyder
Browse files

prevent duplicate mount point entries

parent 5a3d1bdc
...@@ -932,10 +932,21 @@ static int mnt_data_cmp(const void* a, const void* b) ...@@ -932,10 +932,21 @@ static int mnt_data_cmp(const void* a, const void* b)
/* adds an entry to table of mounted file systems */ /* adds an entry to table of mounted file systems */
static void add_entry(char* buf, int* space_left, struct mntent* entry) static void add_entry(char* buf, int* space_left, struct mntent* entry)
{ {
int i;
int ret; int ret;
char tmp_mnt[256]; char tmp_mnt[256];
struct statfs statfsbuf; struct statfs statfsbuf;
/* avoid adding the same mount points multiple times -- to limit
* storage space and potential statfs, ioctl, etc calls
*/
for(i = 0; i < mnt_data_count; i++)
{
if((strncmp(mnt_data_array[i].path, entry->mnt_dir, DARSHAN_MAX_MNT_PATH) == 0) &&
(strncmp(mnt_data_array[i].type, entry->mnt_type, DARSHAN_MAX_MNT_PATH) == 0))
return;
}
strncpy(mnt_data_array[mnt_data_count].path, entry->mnt_dir, strncpy(mnt_data_array[mnt_data_count].path, entry->mnt_dir,
DARSHAN_MAX_MNT_PATH-1); DARSHAN_MAX_MNT_PATH-1);
strncpy(mnt_data_array[mnt_data_count].type, entry->mnt_type, strncpy(mnt_data_array[mnt_data_count].type, entry->mnt_type,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment