www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/04/02/10:47:22

Date: Wed, 2 Apr 1997 18:38:16 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp-workers AT delorie DOT com
Subject: _rename patch
Message-ID: <Pine.SUN.3.91.970402183453.24503F-100000@is>
MIME-Version: 1.0

The last patch to RCS was triggered by some wierd network redirector which
returns error code 2 (file doesn't exist) when you try to rename a file on
a networked drive and the target of the rename already exists (we expect
DOS to return code 5: access denied).  The following patch to `_rename' 
fixes that problem and makes the patch to RCS unnecessary:

*** src/libc/ansi/stdio/_rename.c~0	Sun Oct 27 19:36:54 1996
--- src/libc/ansi/stdio/_rename.c	Sun Mar 30 13:35:34 1997
***************
*** 1,7 ****
--- 1,9 ----
+ /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  #include <libc/stubs.h>
  #include <stdio.h>
  #include <errno.h>
+ #include <unistd.h>
  #include <fcntl.h>
  #include <io.h>
  #include <go32.h>
*************** int _rename(const char *old, const char 
*** 85,91 ****
      __dpmi_int(0x21, &r);
      if(r.x.flags & 1)
      {
!       if (r.x.ax == 5 && i == 0) /* access denied */
  	remove(new);		 /* and try again */
        else
        {
--- 87,94 ----
      __dpmi_int(0x21, &r);
      if(r.x.flags & 1)
      {
!       if (i == 0
! 	  && (r.x.ax == 5 || (r.x.ax == 2 && __file_exists(old))))
  	remove(new);		 /* and try again */
        else
        {


- Raw text -


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