From abe7f530bf5c741fe6f0658da7be59d8db168f7f Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Wed, 10 Apr 2013 11:31:46 +0530 Subject: Accept leading and trailing spaces in getdate input string Fixes #15346. The POSIX description of getdate allows for extra spaces in the getdate input string. __getdate_r uses strptime internally, which works fine with extra spaces between format strings (and hence within an input string) but not with leading and trailing spaces. So we trim off the leading and trailing spaces before we pass it on to strptime. --- time/tst-getdate.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'time/tst-getdate.c') diff --git a/time/tst-getdate.c b/time/tst-getdate.c index 7604e8394f..dc8ecf413a 100644 --- a/time/tst-getdate.c +++ b/time/tst-getdate.c @@ -31,6 +31,10 @@ static const struct } tests [] = { {"21:01:10 1999-1-31", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}}, + {"21:01:10 1999-1-31", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}}, + {" 21:01:10 1999-1-31", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}}, + {"21:01:10 1999-1-31 ", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}}, + {" 21:01:10 1999-1-31 ", "Universal", 0, {10, 1, 21, 31, 0, 99, 0, 0, 0}}, {"21:01:10 1999-2-28", "Universal", 0, {10, 1, 21, 28, 1, 99, 0, 0, 0}}, {"16:30:46 2000-2-29", "Universal", 0, {46, 30,16, 29, 1, 100, 0, 0, 0}}, {"01-08-2000 05:06:07", "Europe/Berlin", 0, {7, 6, 5, 1, 7, 100, 0, 0, 0}} -- cgit v1.2.3