Fix ztest vdev file paths.
[zfs.git] / cmd / ztest / ztest.c
index 15f170d..4aca527 100644 (file)
@@ -2567,7 +2567,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
                newvd_is_spare = B_TRUE;
                (void) strcpy(newpath, newvd->vdev_path);
        } else {
-               (void) snprintf(newpath, sizeof (newpath), ztest_dev_template,
+               (void) snprintf(newpath, MAXPATHLEN, ztest_dev_template,
                    zopt_dir, zopt_pool, top * leaves + leaf);
                if (ztest_random(2) == 0)
                        newpath[strlen(newpath) - 1] = 'b';
@@ -4633,9 +4633,9 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
                 * write failures and random online/offline activity on leaf 0,
                 * and we'll write random garbage to the randomly chosen leaf.
                 */
-               (void) snprintf(path0, sizeof (path0), ztest_dev_template,
+               (void) snprintf(path0, MAXPATHLEN, ztest_dev_template,
                    zopt_dir, zopt_pool, top * leaves + zs->zs_splits);
-               (void) snprintf(pathrand, sizeof (pathrand), ztest_dev_template,
+               (void) snprintf(pathrand, MAXPATHLEN, ztest_dev_template,
                    zopt_dir, zopt_pool, top * leaves + leaf);
 
                vd0 = vdev_lookup_by_path(spa->spa_root_vdev, path0);
@@ -4999,7 +4999,7 @@ ztest_run_zdb(char *pool)
 
        fp = popen(zdb, "r");
 
-       while (fgets(zbuf, sizeof (zbuf), fp) != NULL)
+       while (fgets(zbuf, 1024, fp) != NULL)
                if (zopt_verbose >= 3)
                        (void) printf("%s", zbuf);
 
@@ -5390,8 +5390,9 @@ ztest_run(ztest_shared_t *zs)
        /*
         * Create a thread to periodically resume suspended I/O.
         */
-       VERIFY3P((resume_thread = thread_create(NULL, 0, ztest_resume_thread,
-           spa, TS_RUN, NULL, 0, 0)), !=, NULL);
+       VERIFY3P((resume_thread = zk_thread_create(NULL, 0,
+           (thread_func_t)ztest_resume_thread, spa, TS_RUN, NULL, 0, 0,
+           PTHREAD_CREATE_JOINABLE)), !=, NULL);
 
        /*
         * Set a deadman alarm to abort() if we hang.
@@ -5437,8 +5438,10 @@ ztest_run(ztest_shared_t *zs)
                if (t < zopt_datasets && ztest_dataset_open(zs, t) != 0)
                        return;
 
-               VERIFY3P(thread = thread_create(NULL, 0, ztest_thread,
-                   (void *)(uintptr_t)t, TS_RUN, NULL, 0, 0), !=, NULL);
+               VERIFY3P(thread = zk_thread_create(NULL, 0,
+                   (thread_func_t)ztest_thread,
+                   (void *)(uintptr_t)t, TS_RUN, NULL, 0, 0,
+                   PTHREAD_CREATE_JOINABLE), !=, NULL);
                tid[t] = thread->t_tid;
        }