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 6A237139695 for ; Fri, 12 May 2017 02:42:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 68A0DE0CBF; Fri, 12 May 2017 02:42:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 40497E0CBF for ; Fri, 12 May 2017 02:42:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 1389F3416AB for ; Fri, 12 May 2017 02:42:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6F6097456 for ; Fri, 12 May 2017 02:42:46 +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: <1494537732.6b4050ab9cf9d678a1d6b7af7af7494f8533dbca.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/, src/includes/ X-VCS-Repository: proj/openrc X-VCS-Files: src/includes/rc-misc.h src/rc/rc-misc.c src/rc/supervise-daemon.c X-VCS-Directories: src/rc/ src/includes/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 6b4050ab9cf9d678a1d6b7af7af7494f8533dbca X-VCS-Branch: master Date: Fri, 12 May 2017 02:42:46 +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: a8ecf68d-19d2-4101-bd87-1b16381072e0 X-Archives-Hash: 5953f2b7a6ba4a28c80b1f13f78bfb21 commit: 6b4050ab9cf9d678a1d6b7af7af7494f8533dbca Author: William Hubbs gmail com> AuthorDate: Thu May 11 21:18:41 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Thu May 11 21:22:12 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=6b4050ab fix from_time_t function src/includes/rc-misc.h | 2 +- src/rc/rc-misc.c | 5 +---- src/rc/supervise-daemon.c | 4 +++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/includes/rc-misc.h b/src/includes/rc-misc.h index 384328e7..95ccbc33 100644 --- a/src/includes/rc-misc.h +++ b/src/includes/rc-misc.h @@ -69,7 +69,7 @@ RC_DEPTREE *_rc_deptree_load (int, int *); bool _rc_can_find_pids(void); RC_SERVICE lookup_service_state(const char *service); -char *from_time_t(time_t tv); +void from_time_t(char *time_string, time_t tv); time_t to_time_t(char *timestring); #endif diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index b75c3b4e..1a98537c 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -443,12 +443,9 @@ RC_SERVICE lookup_service_state(const char *service) return 0; } -char *from_time_t(time_t tv) +void from_time_t(char *time_string, time_t tv) { - char time_string[20]; - strftime(time_string, 20, "%Y-%m-%d %H:%M:%S", localtime(&tv)); - return time_string; } time_t to_time_t(char *timestring) diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c index a971e6a3..f3335fa2 100644 --- a/src/rc/supervise-daemon.c +++ b/src/rc/supervise-daemon.c @@ -186,6 +186,7 @@ static void child_process(char *exec, char **argv, char *svcname, char cmdline[PATH_MAX]; time_t start_time; char start_count_string[20]; + char start_time_string[20]; #ifdef HAVE_PAM pam_handle_t *pamh = NULL; @@ -343,7 +344,8 @@ static void child_process(char *exec, char **argv, char *svcname, syslog(LOG_INFO, "Running command line: %s", cmdline); if (svcname) { start_time = time(NULL); - rc_service_value_set(svcname, "start_time", from_time_t(start_time)); +from_time_t(start_time_string, start_time); + rc_service_value_set(svcname, "start_time", start_time_string); sprintf(start_count_string, "%i", start_count); rc_service_value_set(svcname, "start_count", start_count_string); }