From: Alejandro Colomar Date: Thu, 15 Feb 2024 11:59:23 +0000 (+0100) Subject: lib/getdate.y: get_date(): Fix calculation X-Git-Tag: 4.14.6~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fee5e61d05534f5450d87e964f598c11e5c7dd13;p=thirdparty%2Fshadow.git 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 Cherry-picked-from: 4d139ca46682 ("lib/getdate.y: get_date(): Fix calculation") Link: Signed-off-by: Alejandro Colomar --- diff --git a/lib/getdate.y b/lib/getdate.y index 2e13e2dc9..b750b40c3 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -318,7 +318,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelYear += $1 * $2; } | tYEAR_UNIT { - yyRelYear++; + yyRelYear += $1; } | tUNUMBER tMONTH_UNIT { yyRelMonth += $1 * $2; @@ -327,7 +327,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelMonth += $1 * $2; } | tMONTH_UNIT { - yyRelMonth++; + yyRelMonth += $1; } | tUNUMBER tDAY_UNIT { yyRelDay += $1 * $2; @@ -336,7 +336,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelDay += $1 * $2; } | tDAY_UNIT { - yyRelDay++; + yyRelDay += $1; } | tUNUMBER tHOUR_UNIT { yyRelHour += $1 * $2; @@ -345,7 +345,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelHour += $1 * $2; } | tHOUR_UNIT { - yyRelHour++; + yyRelHour += $1; } | tUNUMBER tMINUTE_UNIT { yyRelMinutes += $1 * $2; @@ -354,7 +354,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelMinutes += $1 * $2; } | tMINUTE_UNIT { - yyRelMinutes++; + yyRelMinutes += $1; } | tUNUMBER tSEC_UNIT { yyRelSeconds += $1 * $2; @@ -363,7 +363,7 @@ relunit : tUNUMBER tYEAR_UNIT { yyRelSeconds += $1 * $2; } | tSEC_UNIT { - yyRelSeconds++; + yyRelSeconds += $1; } ;