Whamcloud - gitweb
LU-4438 utils: handle ct_setup() errors
[fs/lustre-release.git] / lustre / utils / lhsmtool_posix.c
index 2e82fbc..7650a8d 100644 (file)
@@ -1844,7 +1844,7 @@ static int ct_setup(void)
        if (rc < 0) {
                CT_ERROR(rc, "cannot find a Lustre filesystem mounted at '%s'",
                         opt.o_mnt);
        if (rc < 0) {
                CT_ERROR(rc, "cannot find a Lustre filesystem mounted at '%s'",
                         opt.o_mnt);
-               return -rc;
+               return rc;
        }
 
        return rc;
        }
 
        return rc;
@@ -1877,7 +1877,9 @@ int main(int argc, char **argv)
                return -rc;
        }
 
                return -rc;
        }
 
-       ct_setup();
+       rc = ct_setup();
+       if (rc < 0)
+               goto error_cleanup;
 
        switch (opt.o_action) {
        case CA_IMPORT:
 
        switch (opt.o_action) {
        case CA_IMPORT:
@@ -1899,6 +1901,7 @@ int main(int argc, char **argv)
                         " rc=%d (%s)", err_major, err_minor, rc,
                         strerror(-rc));
 
                         " rc=%d (%s)", err_major, err_minor, rc,
                         strerror(-rc));
 
+error_cleanup:
        ct_cleanup();
 
        return -rc;
        ct_cleanup();
 
        return -rc;