From 8a4a44b5aa46c9d035ba939da61881d622ad5f12 Mon Sep 17 00:00:00 2001 From: Maxim Sobolev Date: Wed, 30 Nov 2005 19:24:51 +0000 Subject: 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 --- sys/geom/uzip/g_uzip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/geom/uzip/g_uzip.c') 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)); -- cgit v1.2.3