Skip to content

Commit

Permalink
drivers/main.c: Hush the fopen(pidfile) messages *before* dealing wit…
Browse files Browse the repository at this point in the history
…h "INSTCMD driver.exit" so that we can make that verbose again if dialog started but failed to stop the other driver [networkupstools#2384, networkupstools#2392]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Apr 13, 2024
1 parent aa25c9f commit deba0a9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions drivers/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,10 @@ int main(int argc, char **argv)
* earlier instance to exit cleanly. After all, this socket file
* should exist for the driver to talk to the NUT data server...
*/

/* Hush the fopen(pidfile) message but let "real errors" be seen */
nut_sendsignal_debug_level = NUT_SENDSIGNAL_DEBUG_LEVEL_FOPEN_PIDFILE - 1;

if (!cmd && (!do_forceshutdown)) {
ssize_t cmdret = -1;
char buf[LARGEBUF];
Expand Down Expand Up @@ -2187,16 +2191,20 @@ int main(int argc, char **argv)
* but as we report a fault here - let the
* user know that not all is lost right now :)
*/

/* Restore the signal errors verbosity, so that
* e.g. follow-up fopen() issues can be seen -
* we did probably encounter a sibling driver
* instance after all, so can talk about it.
*/
nut_sendsignal_debug_level = NUT_SENDSIGNAL_DEBUG_LEVEL_DEFAULT;
}
}

/* Restore the signal errors verbosity */
/* Restore the socket protocol errors verbosity */
nut_upsdrvquery_debug_level = NUT_UPSDRVQUERY_DEBUG_LEVEL_DEFAULT;
}

/* Hush the fopen(pidfile) message but let "real errors" be seen */
nut_sendsignal_debug_level = NUT_SENDSIGNAL_DEBUG_LEVEL_FOPEN_PIDFILE - 1;

#ifndef WIN32
/* Setup PID file to receive signals to communicate with this driver
* instance once backgrounded (or staying foregrounded with `-FF`),
Expand Down

0 comments on commit deba0a9

Please sign in to comment.