diff options
author | sobomax <sobomax@FreeBSD.org> | 2005-11-30 19:24:51 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2005-11-30 19:24:51 +0000 |
commit | 29543921eae6a40180f2f784021ed1b42d328e2a (patch) | |
tree | 81ef73354089000f24e964c7cdffc0035dfe7d01 /sys/geom/uzip/g_uzip.c | |
parent | 937b629bd5f0ccf20166962cb9ec63905573b02c (diff) | |
download | FreeBSD-src-29543921eae6a40180f2f784021ed1b42d328e2a.zip FreeBSD-src-29543921eae6a40180f2f784021ed1b42d328e2a.tar.gz |
Check for g_read_data(9) errors properly:
o The only indication of error condition is NULL value returned by
the function;
o value pointed to by error argument is undefined in the case when
operation completes successfully.
Discussed with: phk
Diffstat (limited to 'sys/geom/uzip/g_uzip.c')
-rw-r--r-- | sys/geom/uzip/g_uzip.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/geom/uzip/g_uzip.c b/sys/geom/uzip/g_uzip.c index 7fb5614..4fcb137 100644 --- a/sys/geom/uzip/g_uzip.c +++ b/sys/geom/uzip/g_uzip.c @@ -380,7 +380,7 @@ g_uzip_taste(struct g_class *mp, struct g_provider *pp, int flags) DPRINTF(("%s: media sectorsize %u, mediasize %lld\n", gp->name, pp->sectorsize, pp->mediasize)); buf = g_read_data(cp, 0, pp->sectorsize, &error); - if (buf == NULL || error != 0) + if (buf == NULL) goto err; header = (struct cloop_header *) buf; if (strncmp(header->magic, CLOOP_MAGIC_START, @@ -430,7 +430,7 @@ g_uzip_taste(struct g_class *mp, struct g_provider *pp, int flags) free(buf, M_GEOM); buf = g_read_data( cp, blk * pp->sectorsize, pp->sectorsize, &error); - if (buf == NULL || error != 0) + if (buf == NULL) goto err; nread = MIN(total_offsets - offsets_read, pp->sectorsize / sizeof(uint64_t)); |