| File: | build-scan/../src/test/test-umount.c |
| Warning: | line 19, column 25 Although the value stored to 'testdata_fname' is used in the enclosing expression, the value is never actually read from 'testdata_fname' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
| 2 | |
| 3 | #include "alloc-util.h" |
| 4 | #include "log.h" |
| 5 | #include "path-util.h" |
| 6 | #include "string-util.h" |
| 7 | #include "tests.h" |
| 8 | #include "umount.h" |
| 9 | #include "util.h" |
| 10 | |
| 11 | static void test_mount_points_list(const char *fname) { |
| 12 | _cleanup_(mount_points_list_free)__attribute__((cleanup(mount_points_list_free))) LIST_HEAD(MountPoint, mp_list_head)MountPoint *mp_list_head; |
| 13 | _cleanup_free___attribute__((cleanup(freep))) char *testdata_fname = NULL((void*)0); |
| 14 | MountPoint *m; |
| 15 | |
| 16 | log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/self/mountinfo")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 16, __func__, "/* %s(\"%s\") */" , __func__, fname ?: "/proc/self/mountinfo") : -abs(_e); }); |
| 17 | |
| 18 | if (fname) |
| 19 | fname = testdata_fname = path_join(NULL((void*)0), get_testdata_dir(), fname); |
Although the value stored to 'testdata_fname' is used in the enclosing expression, the value is never actually read from 'testdata_fname' | |
| 20 | |
| 21 | LIST_HEAD_INIT(mp_list_head)do { (mp_list_head) = ((void*)0); } while (0); |
| 22 | assert_se(mount_points_list_get(fname, &mp_list_head) >= 0)do { if ((__builtin_expect(!!(!(mount_points_list_get(fname, & mp_list_head) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD , ("mount_points_list_get(fname, &mp_list_head) >= 0") , "../src/test/test-umount.c", 22, __PRETTY_FUNCTION__); } while (0); |
| 23 | |
| 24 | LIST_FOREACH(mount_point, m, mp_list_head)for ((m) = (mp_list_head); (m); (m) = (m)->mount_point_next ) |
| 25 | log_debug("path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u",({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 30, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 26 | m->path,({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 30, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 27 | strempty(m->remount_options),({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 30, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 28 | m->remount_flags,({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 30, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 29 | yes_no(m->try_remount_ro),({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 30, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 30 | major(m->devnum), minor(m->devnum))({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 30, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }); |
| 31 | } |
| 32 | |
| 33 | static void test_swap_list(const char *fname) { |
| 34 | _cleanup_(mount_points_list_free)__attribute__((cleanup(mount_points_list_free))) LIST_HEAD(MountPoint, mp_list_head)MountPoint *mp_list_head; |
| 35 | _cleanup_free___attribute__((cleanup(freep))) char *testdata_fname = NULL((void*)0); |
| 36 | MountPoint *m; |
| 37 | |
| 38 | log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/swaps")({ int _level = (((6))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 38, __func__, "/* %s(\"%s\") */" , __func__, fname ?: "/proc/swaps") : -abs(_e); }); |
| 39 | |
| 40 | if (fname) |
| 41 | fname = testdata_fname = path_join(NULL((void*)0), get_testdata_dir(), fname); |
| 42 | |
| 43 | LIST_HEAD_INIT(mp_list_head)do { (mp_list_head) = ((void*)0); } while (0); |
| 44 | assert_se(swap_list_get(fname, &mp_list_head) >= 0)do { if ((__builtin_expect(!!(!(swap_list_get(fname, &mp_list_head ) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ( "swap_list_get(fname, &mp_list_head) >= 0"), "../src/test/test-umount.c" , 44, __PRETTY_FUNCTION__); } while (0); |
| 45 | |
| 46 | LIST_FOREACH(mount_point, m, mp_list_head)for ((m) = (mp_list_head); (m); (m) = (m)->mount_point_next ) |
| 47 | log_debug("path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u",({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 52, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 48 | m->path,({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 52, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 49 | strempty(m->remount_options),({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 52, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 50 | m->remount_flags,({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 52, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 51 | yes_no(m->try_remount_ro),({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 52, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }) |
| 52 | major(m->devnum), minor(m->devnum))({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/test/test-umount.c", 52, __func__, "path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u" , m->path, strempty(m->remount_options), m->remount_flags , yes_no(m->try_remount_ro), gnu_dev_major (m->devnum), gnu_dev_minor (m->devnum)) : -abs(_e); }); |
| 53 | } |
| 54 | |
| 55 | int main(int argc, char **argv) { |
| 56 | log_set_max_level(LOG_DEBUG)log_set_max_level_realm(LOG_REALM_SYSTEMD, (7)); |
| 57 | log_parse_environment()log_parse_environment_realm(LOG_REALM_SYSTEMD); |
| 58 | log_open(); |
| 59 | |
| 60 | test_mount_points_list(NULL((void*)0)); |
| 61 | test_mount_points_list("/test-umount/empty.mountinfo"); |
| 62 | test_mount_points_list("/test-umount/garbled.mountinfo"); |
| 63 | test_mount_points_list("/test-umount/rhbug-1554943.mountinfo"); |
| 64 | |
| 65 | test_swap_list(NULL((void*)0)); |
| 66 | test_swap_list("/test-umount/example.swaps"); |
| 67 | } |