Skip to content

Commit 87ad5ef

Browse files
committed
Reverse module unload order to satisfy module dependencies in RTAI
1 parent 906dc94 commit 87ad5ef

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/hal/utils/halcmd_commands.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,16 +1359,16 @@ int do_unloadrt_cmd(char *mod_name)
13591359
halcmd_error("component '%s' is not loaded\n", mod_name);
13601360
return -1;
13611361
}
1362-
/* we now have a list of components, unload them */
1363-
n = 0;
1362+
/* we now have a list of components, unload them in reverse order */
1363+
n -= 1;
13641364
retval1 = 0;
1365-
while ( comps[n][0] != '\0' ) {
1365+
while ( n >= 0 ) {
13661366
// special case: initial prefix means it is not a real comp
13671367
if (strstr(comps[n],HAL_PSEUDO_COMP_PREFIX) == comps[n] ) {
1368-
n++;
1368+
n--;
13691369
continue;
13701370
}
1371-
retval = unloadrt_comp(comps[n++]);
1371+
retval = unloadrt_comp(comps[n--]);
13721372
/* check for fatal error */
13731373
if ( retval < -1 ) {
13741374
return retval;

0 commit comments

Comments
 (0)