* fhandler_raw.cc (fhandler_dev_raw::ioctl): Fix setting devbuf

when rd_parm is 0 or 1.
This commit is contained in:
Corinna Vinschen 2005-12-07 18:35:29 +00:00
parent 46bcbf8ce0
commit bb4e8382c5
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2005-12-07 Corinna Vinschen <corinna@vinschen.de>
* fhandler_raw.cc (fhandler_dev_raw::ioctl): Fix setting devbuf
when rd_parm is 0 or 1.
2005-12-07 Corinna Vinschen <corinna@vinschen.de>
* fhandler_floppy.cc (fhandler_dev_floppy::lseek): Fix test for

View File

@ -161,7 +161,9 @@ fhandler_dev_raw::ioctl (unsigned int cmd, void *buf)
ret = ERROR_INVALID_PARAMETER;
else if (!devbuf || op->rd_parm != devbufsiz)
{
char *buf = new char [op->rd_parm];
char *buf = NULL;
if (op->rd_parm > 1L)
buf = new char [op->rd_parm];
if (devbufsiz > 1L)
{
memcpy (buf, devbuf + devbufstart, devbufend - devbufstart);
@ -173,7 +175,7 @@ fhandler_dev_raw::ioctl (unsigned int cmd, void *buf)
devbufstart = 0;
devbuf = buf;
devbufsiz = op->rd_parm;
devbufsiz = op->rd_parm ?: 1L;
}
break;
default:
@ -187,7 +189,7 @@ fhandler_dev_raw::ioctl (unsigned int cmd, void *buf)
if (!get)
ret = ERROR_INVALID_PARAMETER;
else
get->bufsiz = devbufsiz ? devbufsiz : 1L;
get->bufsiz = devbufsiz ?: 1L;
}
else
return fhandler_base::ioctl (cmd, buf);