summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Pereiaslov <perk11@perk11.info>2023-09-03 20:29:13 -0500
committerKonstantin Pereiaslov <perk11@perk11.info>2023-09-03 20:29:13 -0500
commitd85a6c3e1180c18671fda223c033f92660a5bbf9 (patch)
treeaf1ac6ce7571eea736d78afb96d194203a79502e
parent4c7e4b5c80fe9226ccc33ba6951bd6e2c0dfa023 (diff)
More debug output
-rw-r--r--main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.c b/main.c
index 32f7ce0..630abfd 100644
--- a/main.c
+++ b/main.c
@@ -44,9 +44,12 @@ void pause_command(pid_t pid) {
if (!quiet) {
printf("User activity is detected, pausing PID %i\n", pid);
}
- if (kill(pid, SIGTSTP) == -1) {
+ int kill_result = kill(pid, SIGTSTP);
+ if (kill_result == -1) {
handle_kill_error("SIGTSTP", pid);
exit(1);
+ } else {
+ if (debug) fprintf(stderr, "kill function sending signal returned %i\n", kill_result);
}
}
@@ -54,9 +57,12 @@ void resume_command(pid_t pid) {
if (!quiet) {
printf("Lack of user activity is detected, resuming PID %i\n", pid);
}
- if (kill(pid, SIGCONT) == -1) {
+ int kill_result = kill(pid, SIGCONT);
+ if (kill_result == -1) {
handle_kill_error("SIGCONT", pid);
exit(1);
+ } else {
+ if (debug) fprintf(stderr, "kill function sending signal returned %i\n", kill_result);
}
}