aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2017-05-11 16:18:41 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-05-11 16:22:12 -0500
commit6b4050ab9cf9d678a1d6b7af7af7494f8533dbca (patch)
tree6b94d20249f51cbe2c10689298454b9136bb921b /src/rc
parentcf5e9aa2bbcdf1783fadeab26586c1134929d928 (diff)
fix from_time_t function
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/rc-misc.c5
-rw-r--r--src/rc/supervise-daemon.c4
2 files changed, 4 insertions, 5 deletions
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);
}