dcavalca / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone
bbf564a
From 1a63987788624a8819b94b199aa6748665f5e957 Mon Sep 17 00:00:00 2001
bbf564a
From: Michal Schmidt <mschmidt@redhat.com>
bbf564a
Date: Sat, 2 Jul 2011 20:41:36 +0200
bbf564a
Subject: [PATCH] shutdown: accept minutes argument without '+'
bbf564a
bbf564a
Both SysVinit's and upstart's shutdown commands accept the number of
bbf564a
minutes with or without the plus sign.
bbf564a
'shutdown -h 1' works in RHEL 5, Fedora 14, Debian 6.
bbf564a
Let's be compatible.
bbf564a
bbf564a
https://bugzilla.redhat.com/show_bug.cgi?id=708886
bbf564a
---
bbf564a
 src/systemctl.c |    4 ++--
bbf564a
 1 files changed, 2 insertions(+), 2 deletions(-)
bbf564a
bbf564a
diff --git a/src/systemctl.c b/src/systemctl.c
bbf564a
index f6dca5b..b584e70 100644
bbf564a
--- a/src/systemctl.c
bbf564a
+++ b/src/systemctl.c
bbf564a
@@ -4815,10 +4815,10 @@ static int parse_time_spec(const char *t, usec_t *_u) {
bbf564a
 
bbf564a
         if (streq(t, "now"))
bbf564a
                 *_u = 0;
bbf564a
-        else if (t[0] == '+') {
bbf564a
+        else if (!strchr(t, ':')) {
bbf564a
                 uint64_t u;
bbf564a
 
bbf564a
-                if (safe_atou64(t + 1, &u) < 0)
bbf564a
+                if (safe_atou64(t, &u) < 0)
bbf564a
                         return -EINVAL;
bbf564a
 
bbf564a
                 *_u = now(CLOCK_REALTIME) + USEC_PER_MINUTE * u;
bbf564a
-- 
bbf564a
1.7.4.4
bbf564a