delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/09/05/10:46:49

Date: Thu, 5 Sep 1996 17:41:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp-workers AT delorie DOT com
Subject: `write' when disk full
Message-Id: <Pine.SUN.3.91.960905173602.1118B-100000@is>
Mime-Version: 1.0

As far as I can see, `_write' still doesn't always correctly detect a disk 
full situation (somehow I always bump on this when porting GNU `cp').  
The diffs below should fix that.

Btw, wasn't the next release supposed to have a `write' which doesn't call
`malloc' but converts `\n' into CR-LF on the fly while putting the buffer
into the transfer buffer?  `write' in the latest snapshot is still
identical to the stock v2.0 version. 

*** src/libc/dos/io/_write.c~0	Sat Nov 25 21:48:30 1995
--- src/libc/dos/io/_write.c	Thu Sep  5 15:37:10 1996
***************
*** 13,19 ****
  int
  _write(int handle, const void* buffer, size_t count)
  {
!   size_t j;
    int nput;
    unsigned long tbsize;
    __dpmi_regs r;
--- 13,19 ----
  int
  _write(int handle, const void* buffer, size_t count)
  {
!   size_t j, i;
    int nput;
    unsigned long tbsize;
    __dpmi_regs r;
***************
*** 43,52 ****
        errno = __doserr_to_errno(r.x.ax);
        return -1;
      }
!     count -= j;
!     buffer = (void *)((int)buffer + j);
!     nput += r.x.ax;
!   } while(count && (r.x.ax == j));
  
    if (count && nput == 0)
    {
--- 43,53 ----
        errno = __doserr_to_errno(r.x.ax);
        return -1;
      }
!     i = r.x.ax;
!     count -= i;
!     buffer = (void *)((int)buffer + i);
!     nput += i;
!   } while(count && (i == j));
  
    if (count && nput == 0)
    {

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019