]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add several assertions
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Apr 2023 05:29:51 +0000 (14:29 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 13 Apr 2023 10:57:29 +0000 (11:57 +0100)
Follow-up for 7947dbe322a922604f3a5b29693e58b370161ad5.

Fixes CID#1508781 and CID#1508783.

src/test/test-varlink.c

index 53539bb2b8320cddc740be244ab2ed47e755f825..679d235c78e055a7a43f9e84b556443956e90a71 100644 (file)
@@ -54,7 +54,7 @@ static void test_fd(int fd, const void *buf, size_t n) {
         ssize_t m;
 
         m = read(fd, rbuf, n + 1);
-
+        assert_se(m >= 0);
         assert_se(memcmp_nn(buf, n, rbuf, m) == 0);
 }
 
@@ -75,6 +75,10 @@ static int method_passfd(Varlink *link, JsonVariant *parameters, VarlinkMethodFl
 
         log_info("%i %i %i", xx, yy, zz);
 
+        assert_se(xx >= 0);
+        assert_se(yy >= 0);
+        assert_se(zz >= 0);
+
         test_fd(xx, "foo", 3);
         test_fd(yy, "bar", 3);
         test_fd(zz, "quux", 4);