File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3192,11 +3192,15 @@ int main(int argc, char **argv)
31923192
31933193 switch (foreground ) {
31943194 case 0 :
3195+ exit_upsdrv_cleanup ();
31953196 background ();
31963197 /* We had saved a PID before backgrounding, but
31973198 * it changes when backgrounding - so save again
31983199 */
31993200 writepid (pidfn );
3201+ dstate_setinfo ("driver.state" , "init.bkdevice" );
3202+ upsdrv_callbacks .upsdrv_initups ();
3203+ dstate_setinfo ("driver.state" , "init.quiet" );
32003204 break ;
32013205
32023206 /* >0: Keep the initial PID; don't care about "!dump_data" here
Original file line number Diff line number Diff line change @@ -1971,9 +1971,13 @@ void upsdrv_cleanup(void)
19711971 comm_driver -> close_dev (udev );
19721972 Free_ReportDesc (pDesc );
19731973 free_report_buffer (reportbuf );
1974+ pDesc = NULL ;
1975+ reportbuf = NULL ;
19741976#if !((defined SHUT_MODE ) && SHUT_MODE )
19751977 USBFreeExactMatcher (exact_matcher );
19761978 USBFreeRegexMatcher (regex_matcher );
1979+ exact_matcher = NULL ;
1980+ regex_matcher = NULL ;
19771981
19781982 free (curDevice .Vendor );
19791983 free (curDevice .Product );
@@ -1983,6 +1987,7 @@ void upsdrv_cleanup(void)
19831987# if (defined WITH_USB_BUSPORT ) && (WITH_USB_BUSPORT )
19841988 free (curDevice .BusPort );
19851989# endif
1990+ memset (& curDevice , '\0' , sizeof (curDevice ));
19861991#endif /* !SHUT_MODE => USB */
19871992}
19881993
You can’t perform that action at this time.
0 commit comments