From 22f35d5af4ee1ec7e367d14c3417f67dbc115a00 Mon Sep 17 00:00:00 2001 From: Simon Lieb Date: Fri, 21 Oct 2016 13:39:01 +0200 Subject: [PATCH] Prefer sigsuspend(2) over pause(2) As OpenBSD manual for pause(3) stated, this function is made obsolete by sigsuspend(2). We may think it will be removed in future for this *nix. On linux, this require defining _POSIX_C_SOURCE to 1. --- config.mk | 2 +- spt.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.mk b/config.mk index f555812..0c96010 100644 --- a/config.mk +++ b/config.mk @@ -16,7 +16,7 @@ INCS+= `pkg-config --cflags libnotify` LIBS+= `pkg-config --libs libnotify` # flags -CPPFLAGS = -DVERSION=\"${VERSION}\" +CPPFLAGS = -DVERSION=\"${VERSION}\" -D_POSIX_C_SOURCE CFLAGS += -g -std=c99 -pedantic -Wall -Os ${INCS} ${DEFS} ${CPPFLAGS} LDFLAGS += -g ${LIBS} diff --git a/spt.c b/spt.c index e1d5e7e..21744d7 100644 --- a/spt.c +++ b/spt.c @@ -108,6 +108,7 @@ usage(void) int main(int argc, char *argv[]) { + sigset_t *emptymask = 0; suspend = 0; ARGBEGIN { @@ -135,7 +136,7 @@ main(int argc, char *argv[]) timecount = 0; while (timecount < timers[i].tmr) if (suspend) - pause(); + sigsuspend(emptymask); else { sleep(1); timecount++;