Reset error code if an ioctl() request is not handled by the generic

disk framework. This stops ld(4) from returning an error for various
ioctl() requests which actually *did* work. As a result fdisk(8) and
therefore also sysinst(8) work with ld(4) devices once again.

Based on a patch supplied by Todd Kover in PR kern/36244, successfully
tested with ld(4)@icp(4).
This commit is contained in:
tron 2007-04-30 17:23:09 +00:00
parent 2ad855f76d
commit c021b87a9d
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld.c,v 1.46 2007/03/04 06:01:42 christos Exp $ */
/* $NetBSD: ld.c,v 1.47 2007/04/30 17:23:09 tron Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.46 2007/03/04 06:01:42 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.47 2007/04/30 17:23:09 tron Exp $");
#include "rnd.h"
@ -396,12 +396,12 @@ ldioctl(dev_t dev, u_long cmd, void *addr, int32_t flag, struct lwp *l)
unit = DISKUNIT(dev);
part = DISKPART(dev);
sc = device_lookup(&ld_cd, unit);
error = 0;
error = disk_ioctl(&sc->sc_dk, cmd, addr, flag, l);
if (error != EPASSTHROUGH)
return (error);
error = 0;
switch (cmd) {
case DIOCGDINFO:
memcpy(addr, sc->sc_dk.dk_label, sizeof(struct disklabel));