summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_bsd.c
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2005-11-30 19:24:51 +0000
committersobomax <sobomax@FreeBSD.org>2005-11-30 19:24:51 +0000
commit29543921eae6a40180f2f784021ed1b42d328e2a (patch)
tree81ef73354089000f24e964c7cdffc0035dfe7d01 /sys/geom/geom_bsd.c
parent937b629bd5f0ccf20166962cb9ec63905573b02c (diff)
downloadFreeBSD-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/geom_bsd.c')
-rw-r--r--sys/geom/geom_bsd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c
index 6b2220d..d715ded 100644
--- a/sys/geom/geom_bsd.c
+++ b/sys/geom/geom_bsd.c
@@ -207,7 +207,7 @@ g_bsd_try(struct g_geom *gp, struct g_slicer *gsp, struct g_consumer *cp, int se
error = 0;
secoff = offset % secsize;
buf = g_read_data(cp, offset - secoff, secsize, &error);
- if (buf == NULL || error != 0)
+ if (buf == NULL)
return (ENOENT);
/* Decode into our native format. */
@@ -248,7 +248,7 @@ g_bsd_writelabel(struct g_geom *gp, u_char *bootcode)
secoff = ms->labeloffset % secsize;
if (bootcode == NULL) {
buf = g_read_data(cp, ms->labeloffset - secoff, secsize, &error);
- if (buf == NULL || error != 0)
+ if (buf == NULL)
return (error);
bcopy(ms->label, buf + secoff, sizeof(ms->label));
} else {
OpenPOWER on IntegriCloud