Add build system
[zfs.git] / cmd / zfs / zfs_main.c
index 9516697..9cb69c1 100644 (file)
@@ -671,7 +671,7 @@ zfs_do_create(int argc, char **argv)
 {
        zfs_type_t type = ZFS_TYPE_FILESYSTEM;
        zfs_handle_t *zhp = NULL;
-       uint64_t volsize;
+       uint64_t volsize = 0;
        int c;
        boolean_t noreserve = B_FALSE;
        boolean_t bflag = B_FALSE;
@@ -764,7 +764,7 @@ zfs_do_create(int argc, char **argv)
                zfs_prop_t resv_prop;
                char *strval;
 
-               if (p = strchr(argv[0], '/'))
+               if ((p = strchr(argv[0], '/')))
                        *p = '\0';
                zpool_handle = zpool_open(g_zfs, argv[0]);
                if (p != NULL)
@@ -1682,7 +1682,7 @@ upgrade_set_callback(zfs_handle_t *zhp, void *data)
        if (version < cb->cb_version) {
                char verstr[16];
                (void) snprintf(verstr, sizeof (verstr),
-                   "%llu", cb->cb_version);
+                   "%llu", (u_longlong_t)cb->cb_version);
                if (cb->cb_lastfs[0] && !same_pool(zhp, cb->cb_lastfs)) {
                        /*
                         * If they did "zfs upgrade -a", then we could
@@ -1720,7 +1720,7 @@ zfs_do_upgrade(int argc, char **argv)
        boolean_t showversions = B_FALSE;
        int ret;
        upgrade_cbdata_t cb = { 0 };
-       char c;
+       signed char c;
        int flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
 
        /* check options */
@@ -1789,11 +1789,11 @@ zfs_do_upgrade(int argc, char **argv)
                ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_FILESYSTEM,
                    NULL, NULL, 0, upgrade_set_callback, &cb);
                (void) printf(gettext("%llu filesystems upgraded\n"),
-                   cb.cb_numupgraded);
+                   (u_longlong_t)cb.cb_numupgraded);
                if (cb.cb_numsamegraded) {
                        (void) printf(gettext("%llu filesystems already at "
                            "this version\n"),
-                           cb.cb_numsamegraded);
+                           (u_longlong_t)cb.cb_numsamegraded);
                }
                if (cb.cb_numfailed != 0)
                        ret = 1;
@@ -1957,9 +1957,9 @@ print_header(zprop_list_t *pl)
                if (pl->pl_next == NULL && !right_justify)
                        (void) printf("%s", header);
                else if (right_justify)
-                       (void) printf("%*s", pl->pl_width, header);
+                       (void) printf("%*s", (int)pl->pl_width, header);
                else
-                       (void) printf("%-*s", pl->pl_width, header);
+                       (void) printf("%-*s", (int)pl->pl_width, header);
        }
 
        (void) printf("\n");
@@ -2550,7 +2550,7 @@ zfs_do_set(int argc, char **argv)
                usage(B_FALSE);
        }
 
-       ret = zfs_for_each(argc - 2, argv + 2, NULL,
+       ret = zfs_for_each(argc - 2, argv + 2, 0,
            ZFS_TYPE_DATASET, NULL, NULL, 0, set_callback, &cb);
 
        return (ret);
@@ -2567,7 +2567,7 @@ zfs_do_snapshot(int argc, char **argv)
 {
        boolean_t recursive = B_FALSE;
        int ret;
-       char c;
+       signed char c;
        nvlist_t *props;
 
        if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0)
@@ -3238,7 +3238,7 @@ append_options(char *mntopts, char *newopts)
        /* original length plus new string to append plus 1 for the comma */
        if (len + 1 + strlen(newopts) >= MNT_LINE_MAX) {
                (void) fprintf(stderr, gettext("the opts argument for "
-                   "'%c' option is too long (more than %d chars)\n"),
+                   "'%s' option is too long (more than %d chars)\n"),
                    "-o", MNT_LINE_MAX);
                usage(B_FALSE);
        }
@@ -4035,7 +4035,7 @@ zfs_do_diff(int argc, char **argv)
        if (copy == NULL)
                usage(B_FALSE);
 
-       if (atp = strchr(copy, '@'))
+       if ((atp = strchr(copy, '@')))
                *atp = '\0';
 
        if ((zhp = zfs_open(g_zfs, copy, ZFS_TYPE_FILESYSTEM)) == NULL)
@@ -4060,7 +4060,7 @@ int
 main(int argc, char **argv)
 {
        int ret;
-       int i;
+       int i = 0;
        char *progname;
        char *cmdname;
 
@@ -4139,6 +4139,7 @@ main(int argc, char **argv)
                        (void) fprintf(stderr, gettext("unrecognized "
                            "command '%s'\n"), cmdname);
                        usage(B_FALSE);
+                       ret = 1;
                }
                libzfs_mnttab_cache(g_zfs, B_FALSE);
        }