diff options
author | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-11-30 19:24:51 +0000 |
---|---|---|
committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-11-30 19:24:51 +0000 |
commit | 8a4a44b5aa46c9d035ba939da61881d622ad5f12 (patch) | |
tree | 81ef73354089000f24e964c7cdffc0035dfe7d01 /sys/geom/uzip/g_uzip.c | |
parent | 6dfb88de8310b3b4d9c61fcbd9428a01ad24cd29 (diff) | |
download | src-8a4a44b5aa46c9d035ba939da61881d622ad5f12.tar.gz src-8a4a44b5aa46c9d035ba939da61881d622ad5f12.zip |
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
Notes
Notes:
svn path=/head/; revision=152967
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 7fb561470af1..4fcb137ee256 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)); |