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/geom_bsd.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/geom_bsd.c')
-rw-r--r-- | sys/geom/geom_bsd.c | 4 |
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 { |