]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/getdate.y: get_date(): Fix calculation
authorAlejandro Colomar <alx@kernel.org>
Thu, 15 Feb 2024 11:59:23 +0000 (12:59 +0100)
committerAlejandro Colomar <alx@kernel.org>
Sat, 17 Feb 2024 02:08:54 +0000 (03:08 +0100)
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: <https://github.com/shadow-maint/shadow/issues/939>
Link: <https://github.com/shadow-maint/shadow/pull/942>
Reported-by: Michael Vetter <jubalh@iodoru.org>
Reported-by: Gus Kenion <https://github.com/kenion>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Cherry-picked-from: 4d139ca46682 ("lib/getdate.y: get_date(): Fix calculation")
Link: <https://github.com/shadow-maint/shadow/pull/952>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/getdate.y

index 2e13e2dc903dcb44e7237a2e17af02731e390024..b750b40c35a42f72f9dde287afd7999e1dd17c51 100644 (file)
@@ -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;
        }
        ;