File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -426,15 +426,21 @@ void upsdrv_help(void)
426426/* optionally tweak prognames[] entries */
427427void upsdrv_tweak_prognames (void )
428428{
429+ void * cookie = nut_common_cookie ();
430+
429431 /* Here we actually tweak libupsclient logging more,
430432 * relying on this method being called early in main.c */
431- upscli_upslog_start_sync (upslog_start_sync (NULL ), nut_common_cookie () );
432- upscli_upslog_set_debug_level (nut_debug_level , nut_common_cookie () );
433- upscli_upslog_setprocname ( xstrdup ( getmyprocname ()), nut_common_cookie ());
433+ upscli_upslog_start_sync (upslog_start_sync (NULL ), cookie );
434+ upscli_upslog_set_debug_level (nut_debug_level , cookie );
435+
434436 /* FIXME: All other calls to setproctag() in main.c would currently
435437 * be invisible to upscli_*() as that object file has no idea about
436438 * the library in this one driver... should we introduce a callback? */
437- upscli_upslog_setproctag (xstrdup (getproctag ()), nut_common_cookie ());
439+ if (cookie != upscli_upslog_cookie ()) {
440+ /* Send over a copy */
441+ upscli_upslog_setprocname (xstrdup (getmyprocname ()), cookie );
442+ upscli_upslog_setproctag (xstrdup (getproctag ()), cookie );
443+ }
438444}
439445
440446void upsdrv_makevartable (void )
You can’t perform that action at this time.
0 commit comments