diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/fdc/fdc.c | 11 | ||||
-rw-r--r-- | sys/isa/fd.c | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index f77393e..ad882db 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -2600,9 +2600,16 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) return (0); case FD_STYPE: /* set drive type */ - if (suser(td) != 0) - return (EPERM); + /* + * Allow setting drive type temporarily iff + * currently unset. Used for fdformat so any + * user can set it, and then start formatting. + */ + if (fd->ft) + return (EINVAL); /* already set */ fd->fts[0] = *(struct fd_type *)addr; + fd->ft = &fd->fts[0]; + fd->flags |= FD_UA; return (0); case FD_GOPTS: /* get drive options */ diff --git a/sys/isa/fd.c b/sys/isa/fd.c index f77393e..ad882db 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -2600,9 +2600,16 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) return (0); case FD_STYPE: /* set drive type */ - if (suser(td) != 0) - return (EPERM); + /* + * Allow setting drive type temporarily iff + * currently unset. Used for fdformat so any + * user can set it, and then start formatting. + */ + if (fd->ft) + return (EINVAL); /* already set */ fd->fts[0] = *(struct fd_type *)addr; + fd->ft = &fd->fts[0]; + fd->flags |= FD_UA; return (0); case FD_GOPTS: /* get drive options */ |