diff options
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_raw.cc | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d6f5657..35bd30c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,10 @@ 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 valid file position at EOM. diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index 479515f..3f45703 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -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); |