author | kergoth <kergoth> | 2003-08-09 17:42:14 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:42:14 (UTC) |
commit | 1ab4ca95e4d2cf24d32b38c9031cb6076351e730 (patch) (side-by-side diff) | |
tree | 644d196b01c7f280981bd17da23c7592a18e5643 /core/opiealarm/opiealarm.c | |
parent | ec14206f63dd93e9fb84c76cbc76fc1968637590 (diff) | |
download | opie-1ab4ca95e4d2cf24d32b38c9031cb6076351e730.zip opie-1ab4ca95e4d2cf24d32b38c9031cb6076351e730.tar.gz opie-1ab4ca95e4d2cf24d32b38c9031cb6076351e730.tar.bz2 |
Merge from BRANCH_1_0
-rw-r--r-- | core/opiealarm/opiealarm.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c index 998cabd..90a743f 100644 --- a/core/opiealarm/opiealarm.c +++ b/core/opiealarm/opiealarm.c @@ -88,16 +88,17 @@ int fork_with_pidfile ( void ) while ( 1 ) sleep ( 1000 ); exit ( 0 ); } else if ( pid < 0 ) { perror ( "forking failed" ); return 0; } + // sleep( 60 ); // child process needs to react to SIGUSR2. This is sent when // a new opiealarm process is started. signal ( SIGUSR2, sig_handler_child ); // save pid if (( fp = fopen ( PIDFILE, "w" ))) { @@ -201,17 +202,17 @@ int main ( int argc, char **argv ) parent_pid = 0; return opt; } int suspend ( int fix_rtc ) { - FILE *fp; + FILE *fp = NULL; char buf [64]; time_t alrt, syst, rtct; struct tm alr, sys, rtc; int fd; int rtc_sys_diff; if ( !fork_with_pidfile ( )) @@ -253,17 +254,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; + fp = NULL; 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 ); @@ -366,17 +367,17 @@ int resume ( int resuspend ) setenv ( "LOGNAME", "root", 1 ); setenv ( "HOME", "/root", 1 ); setenv ( "LD_LIBRARY_PATH", "/opt/QtPalmtop/lib", 1 ); setenv ( "QTDIR", "/opt/QtPalmtop", 1 ); remove_pidfile ( ); - // no need for system() since this process is no longer usefull anyway + // no need for system() since this process is no longer usefull anyway execv ( "/opt/QtPalmtop/bin/qcop", argv ); perror ( "exec for qcop failed" ); return 5; } } } return 0; |