17
17
* Copyright (c) 2015 Research Organization for Information Science
18
18
* and Technology (RIST). All rights reserved.
19
19
* Copyright (c) 2015 Intel, Inc. All rights reserved.
20
+ * Copyright (c) 2017 UT-Battelle, LLC. All rights reserved.
20
21
* $COPYRIGHT$
21
22
*
22
23
* Additional copyrights may follow
@@ -275,12 +276,10 @@ void kill_procs(void) {
275
276
* This is the command that is used to get the information about
276
277
* all the processes that are running. The output looks like the
277
278
* following:
278
- * COMMAND PID USER
279
- * tcsh 12556 rolfv
280
- * ps 14424 rolfv
279
+ * COMMAND PID UID
280
+ * tcsh 12556 1000
281
+ * ps 14424 1000
281
282
* etc.
282
- * Currently, we do not make use of the USER field, but we may later
283
- * on so we grab it also.
284
283
*/
285
284
286
285
/*
@@ -301,7 +300,7 @@ void kill_procs(void) {
301
300
*/
302
301
ortedpid = getppid ();
303
302
304
- /* get the name of the user */
303
+ /* get the userid of the user */
305
304
uid = getuid ();
306
305
asprintf (& this_user , "%d" , uid );
307
306
@@ -322,8 +321,7 @@ void kill_procs(void) {
322
321
psfile = popen (command , "r" );
323
322
/*
324
323
* Read the first line of the output. We just throw it away
325
- * as it is the header consisting of the words COMMAND, PID and
326
- * USER.
324
+ * as it is the header consisting of the words COMMAND, PID and UID.
327
325
*/
328
326
if (NULL == (inputline = orte_getline (psfile ))) {
329
327
free (this_user );
@@ -347,7 +345,7 @@ void kill_procs(void) {
347
345
/* If the user is not us, and the user is not root, then skip
348
346
* further checking. If the user is root, then continue on as
349
347
* we want root to kill off everybody. */
350
- if ((0 != strcmp (user , this_user )) && (0 != strcmp ("root " , this_user ))) {
348
+ if ((0 != strcmp (user , this_user )) && (0 != strcmp ("0 " , this_user ))) {
351
349
/* not us */
352
350
free (inputline );
353
351
continue ;
@@ -371,11 +369,13 @@ void kill_procs(void) {
371
369
* proc is sometimes reported that way
372
370
*/
373
371
if (0 == strncmp ("orted" , procname , strlen ("orted" )) ||
374
- 0 == strncmp ("(orted)" , procname , strlen ("(orted)" ))) {
372
+ 0 == strncmp ("(orted)" , procname , strlen ("(orted)" )) ||
373
+ 0 == strncmp ("orte-dvm" , procname , strlen ("orte-dvm" )) ||
374
+ 0 == strncmp ("(orte-dvm)" , procname , strlen ("(orte-dvm)" ))) {
375
375
if (procpid != ortedpid ) {
376
376
if (orte_clean_globals .verbose ) {
377
377
fprintf (stderr , "orte-clean: found potential rogue orted process"
378
- " (pid=%d,user =%s), sending SIGKILL...\n" ,
378
+ " (pid=%d,uid =%s), sending SIGKILL...\n" ,
379
379
procpid , user );
380
380
}
381
381
/*
@@ -397,7 +397,7 @@ void kill_procs(void) {
397
397
if (procpid != ortedpid ) {
398
398
if (orte_clean_globals .verbose ) {
399
399
fprintf (stderr , "orte-clean: found potential rogue orterun process"
400
- " (pid=%d,user =%s), sending SIGKILL...\n" ,
400
+ " (pid=%d,uid =%s), sending SIGKILL...\n" ,
401
401
procpid , user );
402
402
403
403
}
0 commit comments