-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 | |||
@@ -90,12 +90,13 @@ int fork_with_pidfile ( void ) | |||
90 | exit ( 0 ); | 90 | exit ( 0 ); |
91 | } | 91 | } |
92 | else if ( pid < 0 ) { | 92 | else if ( pid < 0 ) { |
93 | perror ( "forking failed" ); | 93 | perror ( "forking failed" ); |
94 | return 0; | 94 | return 0; |
95 | } | 95 | } |
96 | //sleep( 60 ); | ||
96 | 97 | ||
97 | // child process needs to react to SIGUSR2. This is sent when | 98 | // child process needs to react to SIGUSR2. This is sent when |
98 | // a new opiealarm process is started. | 99 | // a new opiealarm process is started. |
99 | 100 | ||
100 | signal ( SIGUSR2, sig_handler_child ); | 101 | signal ( SIGUSR2, sig_handler_child ); |
101 | 102 | ||
@@ -203,13 +204,13 @@ int main ( int argc, char **argv ) | |||
203 | return opt; | 204 | return opt; |
204 | } | 205 | } |
205 | 206 | ||
206 | 207 | ||
207 | int suspend ( int fix_rtc ) | 208 | int suspend ( int fix_rtc ) |
208 | { | 209 | { |
209 | FILE *fp; | 210 | FILE *fp = NULL; |
210 | char buf [64]; | 211 | char buf [64]; |
211 | time_t alrt, syst, rtct; | 212 | time_t alrt, syst, rtct; |
212 | struct tm alr, sys, rtc; | 213 | struct tm alr, sys, rtc; |
213 | int fd; | 214 | int fd; |
214 | int rtc_sys_diff; | 215 | int rtc_sys_diff; |
215 | 216 | ||
@@ -255,13 +256,13 @@ int suspend ( int fix_rtc ) | |||
255 | break; // ( 1, TIMEFILE ); | 256 | break; // ( 1, TIMEFILE ); |
256 | 257 | ||
257 | if ( !fgets ( buf, sizeof( buf ) - 1, fp )) | 258 | if ( !fgets ( buf, sizeof( buf ) - 1, fp )) |
258 | break; // ( 1, TIMEFILE ); | 259 | break; // ( 1, TIMEFILE ); |
259 | 260 | ||
260 | fclose ( fp ); | 261 | fclose ( fp ); |
261 | fp = 0; | 262 | fp = NULL; |
262 | 263 | ||
263 | alrt = atoi ( buf ); // get the alarm time | 264 | alrt = atoi ( buf ); // get the alarm time |
264 | 265 | ||
265 | if ( alrt == 0 ) | 266 | if ( alrt == 0 ) |
266 | break; // ( 0, TIMEFILE " contains an invalid time description" ); | 267 | break; // ( 0, TIMEFILE " contains an invalid time description" ); |
267 | alrt -= 5; // wake up 5 sec before the specified time | 268 | alrt -= 5; // wake up 5 sec before the specified time |
@@ -368,13 +369,13 @@ int resume ( int resuspend ) | |||
368 | setenv ( "HOME", "/root", 1 ); | 369 | setenv ( "HOME", "/root", 1 ); |
369 | setenv ( "LD_LIBRARY_PATH", "/opt/QtPalmtop/lib", 1 ); | 370 | setenv ( "LD_LIBRARY_PATH", "/opt/QtPalmtop/lib", 1 ); |
370 | setenv ( "QTDIR", "/opt/QtPalmtop", 1 ); | 371 | setenv ( "QTDIR", "/opt/QtPalmtop", 1 ); |
371 | 372 | ||
372 | remove_pidfile ( ); | 373 | remove_pidfile ( ); |
373 | 374 | ||
374 | // no need for system() since this process is no longer usefull anyway | 375 | // no need for system() since this process is no longer usefull anyway |
375 | execv ( "/opt/QtPalmtop/bin/qcop", argv ); | 376 | execv ( "/opt/QtPalmtop/bin/qcop", argv ); |
376 | 377 | ||
377 | perror ( "exec for qcop failed" ); | 378 | perror ( "exec for qcop failed" ); |
378 | return 5; | 379 | return 5; |
379 | } | 380 | } |
380 | } | 381 | } |