summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/opiealarm/opiealarm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c
index 072dca7..465e633 100644
--- a/core/opiealarm/opiealarm.c
+++ b/core/opiealarm/opiealarm.c
@@ -89,13 +89,13 @@ int fork_with_pidfile ( void )
sleep ( 1000 );
exit ( 0 );
}
else if ( pid < 0 ) {
perror ( "forking failed" );
return 0;
- }
+ }
// child process needs to react to SIGUSR2. This is sent when
// a new opiealarm process is started.
signal ( SIGUSR2, sig_handler_child );
@@ -255,12 +255,13 @@ int suspend ( int fix_rtc )
break; // ( 1, TIMEFILE );
if ( !fgets ( buf, sizeof( buf ) - 1, fp ))
break; // ( 1, TIMEFILE );
fclose ( fp );
+ fp = 0;
alrt = atoi ( buf ); // get the alarm time
if ( alrt == 0 )
break; // ( 0, TIMEFILE " contains an invalid time description" );
alrt -= 5; // wake up 5 sec before the specified time
@@ -283,12 +284,13 @@ int suspend ( int fix_rtc )
// from the "resume instance" of opiealarm.
if ( ioctl ( fd, RTC_AIE_OFF, 0 ) < 0 ) // disable RTC alarm irq
break; // ( 1, "ioctl RTC_AIE_OFF" );
close ( fd );
+ fd = -1;
remove_pidfile ( );
return 0;
} while ( 0 );