From 7cf5bfe38b8345b2466d3ef7ba7d06040dc57e9d Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Wed, 16 Aug 2017 20:48:34 -0400 Subject: Improve C example. --- example.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'example.c') diff --git a/example.c b/example.c index b822312..2eeac2d 100644 --- a/example.c +++ b/example.c @@ -1,3 +1,4 @@ +#define _DEFAULT_SOURCE #include #include #include @@ -22,11 +23,14 @@ int main() { // works even if process dies! kill(getpid(), SIGKILL); + + // otherwise, release the inhibition: + close(pipefd[1]); } else { close(pipefd[1]); - close(0); dup2(pipefd[0], 0); execl("./inhibit-screensaver", "./inhibit-screensaver", "c-inhibitor-example", "testing", (char *)NULL); + perror("exec inhibit-screensaver"); exit(1); } } -- cgit v1.2.3-54-g00ecf