From 4d139ca466820b9a5fe8f75b9a0bee6a922d906a Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 15 Feb 2024 12:59:23 +0100 Subject: [PATCH] lib/getdate.y: get_date(): Fix calculation Instead of adding 1, we should add the value the we stored previously in the variable. Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream version, shadow (19990709)") Closes: Link: Reported-by: Michael Vetter Reported-by: Gus Kenion Cc: Iker Pedrosa Cc: Serge Hallyn Signed-off-by: Alejandro Colomar --- lib/getdate.y | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/getdate.y b/lib/getdate.y index cb7d0e8b9..4b37fe70d 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -319,7 +319,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelYear += $1 * $2; } | tYEAR_UNIT { - yyRelYear++; + yyRelYear += $1; } | tUNUMBER tMONTH_UNIT { yyRelMonth += $1 * $2; @@ -328,7 +328,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelMonth += $1 * $2; } | tMONTH_UNIT { - yyRelMonth++; + yyRelMonth += $1; } | tUNUMBER tDAY_UNIT { yyRelDay += $1 * $2; @@ -337,7 +337,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelDay += $1 * $2; } | tDAY_UNIT { - yyRelDay++; + yyRelDay += $1; } | tUNUMBER tHOUR_UNIT { yyRelHour += $1 * $2; @@ -346,7 +346,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelHour += $1 * $2; } | tHOUR_UNIT { - yyRelHour++; + yyRelHour += $1; } | tUNUMBER tMINUTE_UNIT { yyRelMinutes += $1 * $2; @@ -355,7 +355,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelMinutes += $1 * $2; } | tMINUTE_UNIT { - yyRelMinutes++; + yyRelMinutes += $1; } | tUNUMBER tSEC_UNIT { yyRelSeconds += $1 * $2; @@ -364,7 +364,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelSeconds += $1 * $2; } | tSEC_UNIT { - yyRelSeconds++; + yyRelSeconds += $1; } ;