Index: geom_virstor.c =================================================================== --- geom_virstor.c (revision 181459) +++ geom_virstor.c (working copy) @@ -157,7 +157,6 @@ off_t mediasize; u_char *sector; int error, fd; - ssize_t abc; pathgen(name, path, sizeof(path)); sector = NULL; @@ -183,7 +182,7 @@ goto out; } bcopy(md, sector, size); - if ((abc = pwrite(fd, sector, sectorsize, mediasize - sectorsize)) != + if (pwrite(fd, sector, sectorsize, mediasize - sectorsize) != (ssize_t)sectorsize) { error = errno; goto out; @@ -273,7 +272,7 @@ (size_t)(md.md_virsize/(1024 * 1024))); } - msize = secsize = ssize = 0; + msize = secsize = 0; for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); name = gctl_get_ascii(req, param); @@ -291,6 +290,11 @@ } } + if (secsize == 0) { + gctl_error(req, "Device not specified"); + return; + } + if (md.md_chunk_size % secsize != 0) { fprintf(stderr, "Error: chunk size is not a multiple of sector " "size.");