summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-02-15 12:59:23 +0100
committerAlejandro Colomar <alx@kernel.org>2024-02-17 03:08:54 +0100
commitfee5e61d05534f5450d87e964f598c11e5c7dd13 (patch)
tree00f18f6b9224208ed3cd5933027176f67b529a4f
parent9d5591fba90f69bcbd273fb76cccb722953334fb (diff)
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: <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>
-rw-r--r--lib/getdate.y12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/getdate.y b/lib/getdate.y
index 2e13e2dc..b750b40c 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;
}
;