-rw-r--r-- | core/opiealarm/opiealarm.c | 2 |
1 files changed, 2 insertions, 0 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 @@ -253,16 +253,17 @@ int suspend ( int fix_rtc ) // read the wakeup time from TIMEFILE if (!( fp = fopen ( TIMEFILE, "r" ))) 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 alr = *gmtime ( &alrt ); @@ -281,16 +282,17 @@ int suspend ( int fix_rtc ) // iPAQ woke up via RTC irq -- otherwise we would have received a SIGUSR2 // 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 ); if ( fp != NULL ) |