summaryrefslogtreecommitdiff
path: root/core/opiealarm
Side-by-side diff
Diffstat (limited to 'core/opiealarm') (more/less context) (show whitespace changes)
-rw-r--r--core/opiealarm/opiealarm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c
index 90a743f..422865c 100644
--- a/core/opiealarm/opiealarm.c
+++ b/core/opiealarm/opiealarm.c
@@ -327,58 +327,58 @@ int onac ( void )
return on;
}
int resume ( int resuspend )
{
FILE *fp;
// re-suspend when on AC (optional) when woken up via RTC
if ( !opiealarm_was_running ) {
// if opiealarm -s didn't wake up via RTC, the old process gets killed
// by kill_by_pidfile(), which is recorded in opiealarm_was_running
if ( resuspend && onac ( )) {
time_t start, now;
char *argv [4];
if ( !fork_with_pidfile ( ))
return 4;
// we can't wait for the resuspend timeout in the parent process.
// so we fork and tell the parent it can exit immediatly
kill ( parent_pid, SIGUSR1 );
// sleep <resuspend> seconds - this method is much more precise than sleep() !
time ( &start );
do {
sleep ( 1 );
time ( &now );
} while (( now - start ) < resuspend );
if ( onac ( )) { // still on ac ?
argv[0] = "qcop";
argv[1] = "QPE/Desktop";
argv[2] = "suspend()";
argv[3] = 0;
// hard coded for now ...but needed
// another way would be to simulate a power-button press
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 useful anyway
execv ( "/opt/QtPalmtop/bin/qcop", argv );
perror ( "exec for qcop failed" );
return 5;
}
}
}
return 0;
}