1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-22 18:55:29 +03:00
aports/community/gvm-libs/strptime.patch
Robert Contreras a0af6a8b17 community/gvm-libs: Fix parse_nvt_timestamp error
Musl-libc's strptime function doesn't support this formatting. This is similar to commit 7f90328d3f
2020-03-01 09:24:13 +00:00

32 lines
1.9 KiB
Diff

diff --git a/base/nvti.c b/base/nvti.c
index 97f1ec63..f1f36cc7 100644
--- a/base/nvti.c
+++ b/base/nvti.c
@@ -192,22 +192,19 @@ parse_nvt_timestamp (const gchar *str_time)
/* $Date: 2012-02-17 16:05:26 +0100 (Fr, 17. Feb 2012) $ */
/* $Date: Fri, 11 Nov 2011 14:42:28 +0100 $ */
memset (&tm, 0, sizeof (struct tm));
- if (strptime ((char *) str_time, "%F %T %z", &tm) == NULL)
+ if (strptime ((char *) str_time, "%Y-%m-%d %T +%H%M", &tm) == NULL && strptime ((char *) str_time, "%Y-%m-%d %T -%H%M", &tm) == NULL)
{
memset (&tm, 0, sizeof (struct tm));
- if (strptime ((char *) str_time, "$Date: %F %T %z", &tm) == NULL)
+ if (strptime ((char *) str_time, "$Date: %Y-%m-%d %T +%H%M", &tm) == NULL && strptime ((char *) str_time, "$Date: %Y-%m-%d %T -%H%M", &tm) == NULL)
{
memset (&tm, 0, sizeof (struct tm));
- if (strptime ((char *) str_time, "%a %b %d %T %Y %z", &tm) == NULL)
+ if (strptime ((char *) str_time, "%a %b %d %T %Y +%H%M", &tm) == NULL && strptime ((char *) str_time, "%a %b %d %T %Y -%H%M", &tm) == NULL)
{
memset (&tm, 0, sizeof (struct tm));
- if (strptime ((char *) str_time, "$Date: %a, %d %b %Y %T %z", &tm)
- == NULL)
+ if (strptime ((char *) str_time, "$Date: %a, %d %b %Y %T +%H%M", &tm) == NULL && strptime ((char *) str_time, "$Date: %a, %d %b %Y %T -%H%M", &tm) == NULL)
{
memset (&tm, 0, sizeof (struct tm));
- if (strptime ((char *) str_time, "$Date: %a %b %d %T %Y %z",
- &tm)
- == NULL)
+ if (strptime ((char *) str_time, "$Date: %a %b %d %T %Y +%H%M", &tm) == NULL && strptime ((char *) str_time, "$Date: %a %b %d %T %Y -%H%M", &tm) == NULL)
{
g_warning ("%s: Failed to parse time: %s", __FUNCTION__,
str_time);