2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-29 05:17:54 +00:00

Quiet a PVS Studio warning.

The warning that need_comma is always false is correct but in this
case it is better to use a consistent construct so that if the code
is re-ordered no bugs are introduced.
This commit is contained in:
Todd C. Miller 2021-11-20 09:40:06 -07:00
parent dc5ac7424b
commit d83321388d

View File

@ -456,7 +456,7 @@ print_cmndspec_csv(FILE *fp, struct sudoers_parse_tree *parse_tree,
if (len == 0 || timebuf[sizeof(timebuf) - 1] != '\0') { if (len == 0 || timebuf[sizeof(timebuf) - 1] != '\0') {
sudo_warnx("%s", U_("unable to format timestamp")); sudo_warnx("%s", U_("unable to format timestamp"));
} else { } else {
fprintf(fp, "%snotbefore=%s", need_comma ? "," : "", timebuf); fprintf(fp, "%snotbefore=%s", need_comma ? "," : "", timebuf); // -V547
need_comma = true; need_comma = true;
} }
} }