mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-01 06:45:10 +00:00
Silence a false positive from the clang static analyzer.
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
__dso_public int main(int argc, char *argv[]);
|
__dso_public int main(int argc, char *argv[]);
|
||||||
|
|
||||||
struct gentime_test {
|
const struct gentime_test {
|
||||||
char *gentime;
|
char *gentime;
|
||||||
time_t unixtime;
|
time_t unixtime;
|
||||||
} tests[] = {
|
} tests[] = {
|
||||||
@@ -57,13 +57,13 @@ struct gentime_test {
|
|||||||
{ "2017021408.5Z", 1487061000 },
|
{ "2017021408.5Z", 1487061000 },
|
||||||
{ "2017021408,5Z", 1487061000 },
|
{ "2017021408,5Z", 1487061000 },
|
||||||
{ "20170214Z", -1 },
|
{ "20170214Z", -1 },
|
||||||
{ NULL, -1 }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ntests, errors = 0;
|
const int ntests = nitems(tests);
|
||||||
|
int i, errors = 0;
|
||||||
time_t result;
|
time_t result;
|
||||||
|
|
||||||
initprogname(argc > 0 ? argv[0] : "check_gentime");
|
initprogname(argc > 0 ? argv[0] : "check_gentime");
|
||||||
@@ -72,12 +72,12 @@ main(int argc, char *argv[])
|
|||||||
putenv("TZ=EST5EST5");
|
putenv("TZ=EST5EST5");
|
||||||
tzset();
|
tzset();
|
||||||
|
|
||||||
for (ntests = 0; tests[ntests].gentime != NULL; ntests++) {
|
for (i = 0; i < ntests; i++) {
|
||||||
result = parse_gentime(tests[ntests].gentime);
|
result = parse_gentime(tests[i].gentime);
|
||||||
if (result != tests[ntests].unixtime) {
|
if (result != tests[i].unixtime) {
|
||||||
fprintf(stderr, "check_gentime[%d]: %s: expected %lld, got %lld\n",
|
fprintf(stderr, "check_gentime[%d]: %s: expected %lld, got %lld\n",
|
||||||
ntests, tests[ntests].gentime,
|
i, tests[i].gentime,
|
||||||
(long long)tests[ntests].unixtime, (long long)result);
|
(long long)tests[i].unixtime, (long long)result);
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user