1616 * Copyright (c) 2015 Research Organization for Information Science
1717 * and Technology (RIST). All rights reserved.
1818 * Copyright (c) 2015 Intel, Inc. All rights reserved.
19+ * Copyright (c) 2017 UT-Battelle, LLC. All rights reserved.
1920 * $COPYRIGHT$
2021 *
2122 * Additional copyrights may follow
@@ -247,12 +248,10 @@ void kill_procs(void) {
247248 * This is the command that is used to get the information about
248249 * all the processes that are running. The output looks like the
249250 * following:
250- * COMMAND PID USER
251- * tcsh 12556 rolfv
252- * ps 14424 rolfv
251+ * COMMAND PID UID
252+ * tcsh 12556 1000
253+ * ps 14424 1000
253254 * etc.
254- * Currently, we do not make use of the USER field, but we may later
255- * on so we grab it also.
256255 */
257256
258257 /*
@@ -273,7 +272,7 @@ void kill_procs(void) {
273272 */
274273 ortedpid = getppid ();
275274
276- /* get the name of the user */
275+ /* get the userid of the user */
277276 uid = getuid ();
278277 asprintf (& this_user , "%d" , uid );
279278
@@ -294,8 +293,7 @@ void kill_procs(void) {
294293 psfile = popen (command , "r" );
295294 /*
296295 * Read the first line of the output. We just throw it away
297- * as it is the header consisting of the words COMMAND, PID and
298- * USER.
296+ * as it is the header consisting of the words COMMAND, PID and UID.
299297 */
300298 if (NULL == (inputline = orte_getline (psfile ))) {
301299 free (this_user );
@@ -319,7 +317,7 @@ void kill_procs(void) {
319317 /* If the user is not us, and the user is not root, then skip
320318 * further checking. If the user is root, then continue on as
321319 * we want root to kill off everybody. */
322- if ((0 != strcmp (user , this_user )) && (0 != strcmp ("root " , this_user ))) {
320+ if ((0 != strcmp (user , this_user )) && (0 != strcmp ("0 " , this_user ))) {
323321 /* not us */
324322 free (inputline );
325323 continue ;
@@ -343,11 +341,13 @@ void kill_procs(void) {
343341 * proc is sometimes reported that way
344342 */
345343 if (0 == strncmp ("orted" , procname , strlen ("orted" )) ||
346- 0 == strncmp ("(orted)" , procname , strlen ("(orted)" ))) {
344+ 0 == strncmp ("(orted)" , procname , strlen ("(orted)" )) ||
345+ 0 == strncmp ("orte-dvm" , procname , strlen ("orte-dvm" )) ||
346+ 0 == strncmp ("(orte-dvm)" , procname , strlen ("(orte-dvm)" ))) {
347347 if (procpid != ortedpid ) {
348348 if (orte_clean_globals .verbose ) {
349349 fprintf (stderr , "orte-clean: found potential rogue orted process"
350- " (pid=%d,user =%s), sending SIGKILL...\n" ,
350+ " (pid=%d,uid =%s), sending SIGKILL...\n" ,
351351 procpid , user );
352352 }
353353 /*
@@ -369,7 +369,7 @@ void kill_procs(void) {
369369 if (procpid != ortedpid ) {
370370 if (orte_clean_globals .verbose ) {
371371 fprintf (stderr , "orte-clean: found potential rogue orterun process"
372- " (pid=%d,user =%s), sending SIGKILL...\n" ,
372+ " (pid=%d,uid =%s), sending SIGKILL...\n" ,
373373 procpid , user );
374374
375375 }
0 commit comments