]> 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)
committerSerge Hallyn <serge@hallyn.com>
Sat, 17 Feb 2024 01:58:43 +0000 (19:58 -0600)
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>
lib/getdate.y

index cb7d0e8b95cce3ef9351c0e321460f2eab1d68de..4b37fe70d73af888be1936f649bc532b13bd3354 100644 (file)
@@ -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;
        }
        ;