]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
calendarspec: always interpret missing seconds as :00 (#4813)
authorDoug Christman <douglaschristman@gmail.com>
Tue, 6 Dec 2016 19:41:15 +0000 (14:41 -0500)
committerLennart Poettering <lennart@poettering.net>
Tue, 6 Dec 2016 19:41:15 +0000 (20:41 +0100)
"*:*" should be equivalent to "*-*-* *:*:00" (minutely)
rather than running every microsecond.

Fixes #4804

src/basic/calendarspec.c
src/test/test-calendarspec.c

index 8b57de47445e4881568eb6c8acd8fa25336d639c..514587d23728f4d3a5f5f0d630110679faaa16cc 100644 (file)
@@ -752,12 +752,8 @@ static int parse_calendar_time(const char **p, CalendarSpec *c) {
                 goto fail;
 
         /* Already at the end? Then it's hours and minutes, and seconds are 0 */
-        if (*t == 0) {
-                if (m != NULL)
-                        goto null_second;
-
-                goto finish;
-        }
+        if (*t == 0)
+                goto null_second;
 
         if (*t != ':') {
                 r = -EINVAL;
index b3d1160ea7c6469fe4a078b4989a89aaa32b22f7..b8320b081bb445cbba189ed088b57fce92037641 100644 (file)
@@ -186,6 +186,9 @@ int main(int argc, char* argv[]) {
         test_one("Monday *-*-*", "Mon *-*-* 00:00:00");
         test_one("*-*-*", "*-*-* 00:00:00");
         test_one("*:*:*", "*-*-* *:*:*");
+        test_one("*:*", "*-*-* *:*:00");
+        test_one("12:*", "*-*-* 12:*:00");
+        test_one("*:30", "*-*-* *:30:00");
 
         test_next("2016-03-27 03:17:00", "", 12345, 1459048620000000);
         test_next("2016-03-27 03:17:00", "CET", 12345, 1459041420000000);