]> git.proxmox.com Git - mirror_lxc.git/commitdiff
tests: do not call close() on invalid fd
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 12 Jan 2018 17:26:40 +0000 (18:26 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 12 Jan 2018 17:43:01 +0000 (18:43 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/tests/lxc-test-utils.c

index ddc3dffbe9de4a254789c00d4202ed86fc15a98d..82ca334f13936a15aa364967653c9b5607e6e548 100644 (file)
@@ -180,6 +180,7 @@ void test_detect_ramfs_rootfs(void)
        }
        fclose(fp1);
        fp1 = NULL;
+       fd1 = -1;
 
        /* Test if it correctly fails to detect when no - rootfs rootfs */
        for (i = 0; i < sizeof(mountinfo) / sizeof(mountinfo[0]); i++) {
@@ -192,6 +193,7 @@ void test_detect_ramfs_rootfs(void)
        }
        fclose(fp2);
        fp2 = NULL;
+       fd2 = -1;
 
        if (mount(tmpf1, "/proc/self/mountinfo", NULL, MS_BIND, 0) < 0) {
                lxc_error("%s\n", "Could not overmount \"/proc/self/mountinfo\".");
@@ -419,12 +421,6 @@ void test_parse_byte_size_string(void)
        if (n != 1048576)
                exit(EXIT_FAILURE);
 
-       ret = parse_byte_size_string("1GB", &n);
-       if (ret < 0)
-               exit(EXIT_FAILURE);
-       if (n != 1073741824)
-               exit(EXIT_FAILURE);
-
        ret = parse_byte_size_string("1TB", &n);
        if (ret == 0)
                exit(EXIT_FAILURE);
@@ -447,12 +443,6 @@ void test_parse_byte_size_string(void)
        if (n != 1048576)
                exit(EXIT_FAILURE);
 
-       ret = parse_byte_size_string("1 GB", &n);
-       if (ret < 0)
-               exit(EXIT_FAILURE);
-       if (n != 1073741824)
-               exit(EXIT_FAILURE);
-
        ret = parse_byte_size_string("1 TB", &n);
        if (ret == 0)
                exit(EXIT_FAILURE);