Clean up of dead code and possible unassigned variable usage.

Found by:	LLVM/Clang Static Checker
Approved by:	gnn (mentor)
This commit is contained in:
Ivan Voras 2008-08-09 16:47:30 +00:00
parent e6501bf131
commit 970a8ddc44
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181471

View File

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