[systemd-commits] 2 commits - src/libsystemd-network src/test

Thomas H.P. Andersen phomes at kemper.freedesktop.org
Sun Sep 14 13:47:40 PDT 2014


 src/libsystemd-network/test-dhcp-option.c |    6 +++---
 src/test/test-uid-range.c                 |   22 +++++++++++-----------
 2 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 20755373b1494f1b718b1ac3a611c6f807905fe6
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Sun Sep 14 22:25:58 2014 +0200

    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

diff --git a/src/test/test-uid-range.c b/src/test/test-uid-range.c
index 5f3d871..06b4d43 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;
 }

commit 86be3e1e6558f4e7e20c537e644656eb6f37b7d0
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Sun Sep 14 22:06:37 2014 +0200

    sd-dhcp: fix test of magic cookie
    
    The magic cookie is set in dhcp_message_init. Test the magic cookie
    value intead of writing the last 3/4 of it directly.
    
    Found with Coverity. Fixes: CID#1237732 CID#1237734 CID#1237735

diff --git a/src/libsystemd-network/test-dhcp-option.c b/src/libsystemd-network/test-dhcp-option.c
index 92c58e0..7a0fac8 100644
--- a/src/libsystemd-network/test-dhcp-option.c
+++ b/src/libsystemd-network/test-dhcp-option.c
@@ -100,9 +100,9 @@ static void test_message_init(void)
         magic = (uint8_t*)&message->magic;
 
         assert_se(magic[0] == 99);
-        assert_se(magic[1] = 130);
-        assert_se(magic[2] = 83);
-        assert_se(magic[3] = 99);
+        assert_se(magic[1] == 130);
+        assert_se(magic[2] == 83);
+        assert_se(magic[3] == 99);
 
         assert_se(dhcp_option_parse(message, len, NULL, NULL) >= 0);
 }



More information about the systemd-commits mailing list