diff --git a/tests/xbps/libxbps/config/main.c b/tests/xbps/libxbps/config/main.c index d371a32c..401a6896 100644 --- a/tests/xbps/libxbps/config/main.c +++ b/tests/xbps/libxbps/config/main.c @@ -39,6 +39,7 @@ ATF_TC_BODY(config_include_test, tc) struct xbps_handle xh; const char *tcsdir; char *buf, *buf2, pwd[PATH_MAX]; + int ret; /* get test source dir */ tcsdir = atf_tc_get_config_var(tc, "srcdir"); @@ -48,7 +49,9 @@ ATF_TC_BODY(config_include_test, tc) xbps_strlcpy(xh.rootdir, pwd, sizeof(xh.rootdir)); xbps_strlcpy(xh.metadir, pwd, sizeof(xh.metadir)); - snprintf(xh.confdir, sizeof(xh.confdir), "%s/xbps.d", pwd); + ret = snprintf(xh.confdir, sizeof(xh.confdir), "%s/xbps.d", pwd); + ATF_REQUIRE_EQ((ret >= 0), 1); + ATF_REQUIRE_EQ(((size_t)ret < sizeof(xh.confdir)), 1); ATF_REQUIRE_EQ(xbps_mkpath(xh.confdir, 0755), 0); @@ -88,6 +91,7 @@ ATF_TC_BODY(config_include_nomatch_test, tc) struct xbps_handle xh; const char *tcsdir; char *buf, *buf2, pwd[PATH_MAX]; + int ret; /* get test source dir */ tcsdir = atf_tc_get_config_var(tc, "srcdir"); @@ -97,7 +101,9 @@ ATF_TC_BODY(config_include_nomatch_test, tc) xbps_strlcpy(xh.rootdir, tcsdir, sizeof(xh.rootdir)); xbps_strlcpy(xh.metadir, tcsdir, sizeof(xh.metadir)); - snprintf(xh.confdir, sizeof(xh.confdir), "%s/xbps.d", pwd); + ret = snprintf(xh.confdir, sizeof(xh.confdir), "%s/xbps.d", pwd); + ATF_REQUIRE_EQ((ret >= 0), 1); + ATF_REQUIRE_EQ(((size_t)ret < sizeof(xh.confdir)), 1); ATF_REQUIRE_EQ(xbps_mkpath(xh.confdir, 0755), 0);