File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 14
14
* Copyright (c) 2012-2015 Los Alamos National Security, LLC.
15
15
* All rights reserved.
16
16
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
17
+ * Copyright (c) 2017 Research Organization for Information Science
18
+ * and Technology (RIST). All rights reserved.
17
19
* $COPYRIGHT$
18
20
*
19
21
* Additional copyrights may follow
@@ -102,16 +104,24 @@ ompi_mtl_psm2_component_register(void)
102
104
static int
103
105
ompi_mtl_psm2_component_open (void )
104
106
{
107
+ int res ;
105
108
glob_t globbuf ;
106
109
globbuf .gl_offs = 0 ;
107
110
108
111
/* Component available only if Omni-Path hardware is present */
109
- if ((glob ("/dev/hfi1_[0-9]" , GLOB_DOOFFS , NULL , & globbuf ) != 0 ) &&
110
- (glob ("/dev/hfi1_[0-9][0-9]" , GLOB_APPEND , NULL , & globbuf ) != 0 )) {
111
- return OPAL_ERR_NOT_AVAILABLE ;
112
+ res = glob ("/dev/hfi1_[0-9]" , GLOB_DOOFFS , NULL , & globbuf );
113
+ if (0 == res || GLOB_NOMATCH == res ) {
114
+ globfree (& globbuf );
115
+ }
116
+ if (0 != res ) {
117
+ res = glob ("/dev/hfi1_[0-9][0-9]" , GLOB_APPEND , NULL , & globbuf );
118
+ if (0 == res || GLOB_NOMATCH == res ) {
119
+ globfree (& globbuf );
120
+ }
121
+ if (0 != res ) {
122
+ return OPAL_ERR_NOT_AVAILABLE ;
123
+ }
112
124
}
113
-
114
- globfree (& globbuf );
115
125
116
126
/* Component available only if at least one hfi1 port is ACTIVE */
117
127
bool foundOnlineHfi1Port = false;
You can’t perform that action at this time.
0 commit comments