Skip to content

Commit

Permalink
lib/getdate.y: get_date(): Fix calculation
Browse files Browse the repository at this point in the history
Instead of adding 1, we should add the value the we stored previously in
the variable.

Fixes: 45c6603 ("[svn-upgrade] Integrating new upstream version, shadow (19990709)")
Closes: <shadow-maint#939>
Link: <shadow-maint#942>
Reported-by: Michael Vetter <[email protected]>
Reported-by: Gus Kenion <https://github.com/kenion>
Cc: Iker Pedrosa <[email protected]>
Cc: Serge Hallyn <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar authored and hallyn committed Feb 17, 2024
1 parent e15aa5a commit 4d139ca
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/getdate.y
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelYear += $1 * $2;
}
| tYEAR_UNIT {
yyRelYear++;
yyRelYear += $1;
}
| tUNUMBER tMONTH_UNIT {
yyRelMonth += $1 * $2;
Expand All @@ -328,7 +328,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelMonth += $1 * $2;
}
| tMONTH_UNIT {
yyRelMonth++;
yyRelMonth += $1;
}
| tUNUMBER tDAY_UNIT {
yyRelDay += $1 * $2;
Expand All @@ -337,7 +337,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelDay += $1 * $2;
}
| tDAY_UNIT {
yyRelDay++;
yyRelDay += $1;
}
| tUNUMBER tHOUR_UNIT {
yyRelHour += $1 * $2;
Expand All @@ -346,7 +346,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelHour += $1 * $2;
}
| tHOUR_UNIT {
yyRelHour++;
yyRelHour += $1;
}
| tUNUMBER tMINUTE_UNIT {
yyRelMinutes += $1 * $2;
Expand All @@ -355,7 +355,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelMinutes += $1 * $2;
}
| tMINUTE_UNIT {
yyRelMinutes++;
yyRelMinutes += $1;
}
| tUNUMBER tSEC_UNIT {
yyRelSeconds += $1 * $2;
Expand All @@ -364,7 +364,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelSeconds += $1 * $2;
}
| tSEC_UNIT {
yyRelSeconds++;
yyRelSeconds += $1;
}
;

Expand Down

0 comments on commit 4d139ca

Please sign in to comment.