File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -380,6 +380,10 @@ static void clean_exit(void)
380380 free (upsname );
381381 free (hostname );
382382 free (ups );
383+
384+ /* Not a sub-process (do not let common::proctag_cleanup() mis-report us as such) */
385+ upsdebugx (1 , "%s: finished, exiting" , __func__ );
386+ setproctag (NULL );
383387}
384388
385389int main (int argc , char * * argv )
@@ -391,6 +395,7 @@ int main(int argc, char **argv)
391395 const char * net_connect_timeout = NULL ;
392396 char * s = NULL ;
393397
398+ setproctag (prog );
394399 /* NOTE: Caller must `export NUT_DEBUG_LEVEL` to see debugs for upsc
395400 * and NUT methods called from it. This line aims to just initialize
396401 * the subsystem, and set initial timestamp. Debugging the client is
@@ -466,6 +471,7 @@ int main(int argc, char **argv)
466471 fatalx_error_json_simple (0 , "invalid UPS definition.\nRequired format: upsname[@hostname[:port]]" );
467472 }
468473 }
474+ setproctag (argv [0 ]);
469475 upsdebugx (1 , "upsname='%s' hostname='%s' port='%" PRIu16 "'" ,
470476 NUT_STRARG (upsname ), NUT_STRARG (hostname ), port );
471477
Original file line number Diff line number Diff line change @@ -286,6 +286,10 @@ static void clean_exit(void)
286286 free (upsname );
287287 free (hostname );
288288 free (ups );
289+
290+ /* Not a sub-process (do not let common::proctag_cleanup() mis-report us as such) */
291+ upsdebugx (1 , "%s: finished, exiting" , __func__ );
292+ setproctag (NULL );
289293}
290294
291295int main (int argc , char * * argv )
@@ -298,6 +302,7 @@ int main(int argc, char **argv)
298302 const char * prog = xbasename (argv [0 ]);
299303 const char * net_connect_timeout = NULL ;
300304
305+ setproctag (prog );
301306 /* NOTE: Caller must `export NUT_DEBUG_LEVEL` to see debugs for upsc
302307 * and NUT methods called from it. This line aims to just initialize
303308 * the subsystem, and set initial timestamp. Debugging the client is
@@ -378,6 +383,7 @@ int main(int argc, char **argv)
378383 if (upscli_splitname (argv [0 ], & upsname , & hostname , & port ) != 0 ) {
379384 fatalx (EXIT_FAILURE , "Error: invalid UPS definition. Required format: upsname[@hostname[:port]]" );
380385 }
386+ setproctag (argv [0 ]);
381387
382388 ups = (UPSCONN_t * )xcalloc (1 , sizeof (* ups ));
383389
Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ static void clean_exit(void)
8989 free (upsname );
9090 free (hostname );
9191 free (ups );
92+
93+ /* Not a sub-process (do not let common::proctag_cleanup() mis-report us as such) */
94+ upsdebugx (1 , "%s: finished, exiting" , __func__ );
95+ setproctag (NULL );
9296}
9397
9498#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC ) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC ) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC ) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC ) )
@@ -656,6 +660,7 @@ int main(int argc, char **argv)
656660 const char * net_connect_timeout = NULL ;
657661 char * password = NULL , * username = NULL , * setvar = NULL , * s = NULL ;
658662
663+ setproctag (prog );
659664 /* NOTE: Caller must `export NUT_DEBUG_LEVEL` to see debugs for upsc
660665 * and NUT methods called from it. This line aims to just initialize
661666 * the subsystem, and set initial timestamp. Debugging the client is
@@ -732,6 +737,7 @@ int main(int argc, char **argv)
732737 if (upscli_splitname (argv [0 ], & upsname , & hostname , & port ) != 0 ) {
733738 fatalx (EXIT_FAILURE , "Error: invalid UPS definition. Required format: upsname[@hostname[:port]]" );
734739 }
740+ setproctag (argv [0 ]);
735741
736742 ups = (UPSCONN_t * )xcalloc (1 , sizeof (* ups ));
737743
You can’t perform that action at this time.
0 commit comments