Skip to content

Commit 479eee1

Browse files
committed
drivers/main.c: use setproctag() to identify upsname in debug logs [networkupstools#3302, networkupstools#3368]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent e35a697 commit 479eee1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,6 +2004,10 @@ static void exit_cleanup(void)
20042004
free((char*)(prognames[i]));
20052005
}
20062006
}
2007+
2008+
/* Not a sub-process (do not let common::proctag_cleanup() mis-report us as such) */
2009+
upsdebugx(1, "%s: finished, exiting", __func__);
2010+
setproctag(NULL);
20072011
}
20082012
#endif /* DRIVERS_MAIN_WITHOUT_MAIN */
20092013

@@ -2506,6 +2510,7 @@ int main(int argc, char **argv)
25062510
fatalx(EXIT_FAILURE,
25072511
"Error: specifying '-a id' or '-s id' is now mandatory. Try -h for help.");
25082512
}
2513+
setproctag(upsname);
25092514

25102515
/* we need to get the port from somewhere, unless we are just sending a signal and exiting */
25112516
if (!device_path && !cmd) {

0 commit comments

Comments
 (0)