From 7cccedf8dead27e59bbe11c37622b260f6699e1f Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 31 Oct 2000 22:20:59 +0000 Subject: * fhandler.h (fhandler_dev_raw): Add definition for method `fixup_after_fork'. * fhandler_raw.cc (fhandler_dev_raw::fhandler_dev_raw): Add `set_need_fixup_after_fork' call. (fhandler_dev_raw::~fhandler_dev_raw): Revert to user space allocation. (fhandler_dev_raw::open): Ditto. (fhandler_dev_raw::dup): Ditto. Reset buffer pointer. (fhandler_dev_raw::fixup_after_fork): New function. * fhandler_tape.cc (fhandler_dev_tape::open): Revert to user space memory allocation. (fhandler_dev_tape::ioctl): Ditto. Change behaviour on MTSETBLK when new size is 1. --- winsup/cygwin/fhandler_tape.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'winsup/cygwin/fhandler_tape.cc') diff --git a/winsup/cygwin/fhandler_tape.cc b/winsup/cygwin/fhandler_tape.cc index 1dd15e5..d1c2c85 100644 --- a/winsup/cygwin/fhandler_tape.cc +++ b/winsup/cygwin/fhandler_tape.cc @@ -89,7 +89,7 @@ fhandler_dev_tape::open (const char *path, int flags, mode_t) varblkop = get.mt_dsreg == 0; if (devbufsiz > 1L) - devbuf = (char *) cmalloc (HEAP_BUF, devbufsiz); + devbuf = new char [devbufsiz]; /* The following rewind in position 0 solves a problem which appears * in case of multi volume archives: The last ReadFile on first medium @@ -349,20 +349,22 @@ fhandler_dev_tape::ioctl (unsigned int cmd, void *buf) size = get.mt_maxblksize; ret = NO_ERROR; } - char *buf = (char *) cmalloc (HEAP_BUF, size); - if (!buf) + char *buf = NULL; + if (size > 1L && !(buf = new char [size])) { ret = ERROR_OUTOFMEMORY; break; } - if (devbuf) + if (devbufsiz > 1L && size > 1L) { - memcpy(buf,devbuf + devbufstart, devbufend - devbufstart); + memcpy(buf, devbuf + devbufstart, + devbufend - devbufstart); devbufend -= devbufstart; - cfree (devbuf); } else devbufend = 0; + if (devbufsiz > 1L) + delete [] devbuf; devbufstart = 0; devbuf = buf; devbufsiz = size; -- cgit v1.1