systemd/0241-test-fix-test-of-uid-range.patch
Zbigniew Jędrzejewski-Szmek 62fe9450da Update to latest git
2014-10-07 15:51:56 -04:00

80 lines
2.7 KiB
Diff

From 20755373b1494f1b718b1ac3a611c6f807905fe6 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Sun, 14 Sep 2014 22:25:58 +0200
Subject: [PATCH] test: fix test of uid-range
The number of uid's in the range should be tested instead of written
directly.
The test still passes with the fix checks.
Found with Coverity. Fixes: CID#1237714 - 1237722
---
src/test/test-uid-range.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/test/test-uid-range.c b/src/test/test-uid-range.c
index 5f3d871b6c..06b4d43426 100644
--- a/src/test/test-uid-range.c
+++ b/src/test/test-uid-range.c
@@ -32,7 +32,7 @@ int main(int argc, char *argv[]) {
assert_se(uid_range_add_str(&p, &n, "500-999") >= 0);
assert_se(n == 1);
assert_se(p[0].start == 500);
- assert_se(p[0].nr = 500);
+ assert_se(p[0].nr == 500);
assert_se(!uid_range_contains(p, n, 499));
assert_se(uid_range_contains(p, n, 500));
@@ -52,40 +52,40 @@ int main(int argc, char *argv[]) {
assert_se(uid_range_add_str(&p, &n, "1000") >= 0);
assert_se(n == 1);
assert_se(p[0].start == 500);
- assert_se(p[0].nr = 501);
+ assert_se(p[0].nr == 501);
assert_se(uid_range_add_str(&p, &n, "30-40") >= 0);
assert_se(n == 2);
assert_se(p[0].start == 30);
- assert_se(p[0].nr = 11);
+ assert_se(p[0].nr == 11);
assert_se(p[1].start == 500);
- assert_se(p[1].nr = 501);
+ assert_se(p[1].nr == 501);
assert_se(uid_range_add_str(&p, &n, "60-70") >= 0);
assert_se(n == 3);
assert_se(p[0].start == 30);
- assert_se(p[0].nr = 11);
+ assert_se(p[0].nr == 11);
assert_se(p[1].start == 60);
- assert_se(p[1].nr = 11);
+ assert_se(p[1].nr == 11);
assert_se(p[2].start == 500);
- assert_se(p[2].nr = 501);
+ assert_se(p[2].nr == 501);
assert_se(uid_range_add_str(&p, &n, "20-2000") >= 0);
assert_se(n == 1);
assert_se(p[0].start == 20);
- assert_se(p[0].nr = 1981);
+ assert_se(p[0].nr == 1981);
assert_se(uid_range_add_str(&p, &n, "2002") >= 0);
assert_se(n == 2);
assert_se(p[0].start == 20);
- assert_se(p[0].nr = 1981);
+ assert_se(p[0].nr == 1981);
assert_se(p[1].start == 2002);
- assert_se(p[1].nr = 1);
+ assert_se(p[1].nr == 1);
assert_se(uid_range_add_str(&p, &n, "2001") >= 0);
assert_se(n == 1);
assert_se(p[0].start == 20);
- assert_se(p[0].nr = 1983);
+ assert_se(p[0].nr == 1983);
return 0;
}