Avoid NULL-pointer dereference on error condition.

This commit is contained in:
eivind 1998-12-15 23:46:59 +00:00
parent fac338b16a
commit 3a5b7248f8

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: devfs_vnops.c,v 1.62 1998/10/31 15:31:23 peter Exp $
* $Id: devfs_vnops.c,v 1.63 1998/12/07 21:58:30 archie Exp $
*/
@ -1529,11 +1529,11 @@ devfs_write( struct vop_write_args *ap)
bp = getblk(vp, bn, bsize, 0, 0);
else
error = bread(vp, bn, bsize, NOCRED, &bp);
n = min(n, bsize - bp->b_resid);
if (error) {
brelse(bp);
return (error);
}
n = min(n, bsize - bp->b_resid);
error = uiomove((char *)bp->b_data + on, n, uio);
if (n + on == bsize)
bawrite(bp);