From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6B032138334 for ; Sat, 6 Oct 2018 18:03:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 579D9E0AC6; Sat, 6 Oct 2018 18:03:25 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2E533E0AC6 for ; Sat, 6 Oct 2018 18:03:25 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 748A9335CD5 for ; Sat, 6 Oct 2018 18:03:08 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8809742D for ; Sat, 6 Oct 2018 18:03:06 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1538848184.7ee3e5b2d6dbb9c279011b59ec132d27d04f843e.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/openrc-init.c X-VCS-Directories: src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 7ee3e5b2d6dbb9c279011b59ec132d27d04f843e X-VCS-Branch: master Date: Sat, 6 Oct 2018 18:03:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: b8b645eb-de1d-46cd-8bc1-f7ed995d0682 X-Archives-Hash: d59c08c8ac250a0c8fa8c32df88faaf3 commit: 7ee3e5b2d6dbb9c279011b59ec132d27d04f843e Author: William Hubbs gmail com> AuthorDate: Sat Oct 6 17:49:44 2018 +0000 Commit: William Hubbs gentoo org> CommitDate: Sat Oct 6 17:49:44 2018 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=7ee3e5b2 openrc-init: convert sleep() call to nanosleep() Nanosleep is the safer call to use in case we need to use alarms eventually. src/rc/openrc-init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rc/openrc-init.c b/src/rc/openrc-init.c index d8038637..e02fa5ee 100644 --- a/src/rc/openrc-init.c +++ b/src/rc/openrc-init.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -96,12 +97,15 @@ static void handle_reexec(char *my_name) static void handle_shutdown(const char *runlevel, int cmd) { pid_t pid; + struct timespec ts; pid = do_openrc(runlevel); while (waitpid(pid, NULL, 0) != pid); printf("Sending the final term signal\n"); kill(-1, SIGTERM); - sleep(3); + ts.tv_sec = 3; + ts.tv_nsec = 0; + nanosleep(&ts, NULL); printf("Sending the final kill signal\n"); kill(-1, SIGKILL); sync();