delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/06/14/10:58:29

Date: Mon, 14 Jun 1999 17:56:05 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: pavenis AT lanet DOT lv
cc: djgpp-workers AT delorie DOT com
Subject: Re: Wrong errno value from rename() when sharing problems under Win9X
In-Reply-To: <B0000090438@stargate.astr.lu.lv>
Message-ID: <Pine.SUN.3.91.990614175417.23584A@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 14 Jun 1999 pavenis AT lanet DOT lv wrote:

> Rename returns invalid value in errno under Win95 when attempting 
> to rename already opened file (I got ENOENT, should be EACCES).

Thanks for the report.

Does the following fix the bug?

Index: djgpp/src/libc/ansi/stdio/rename.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/rename.c,v
retrieving revision 1.5
diff -c -r1.5 rename.c
*** rename.c	1999/06/03 17:27:33	1.5
--- rename.c	1999/06/14 14:53:39
***************
*** 374,379 ****
--- 374,385 ----
        else if (errno)
  	return -1;
      }
+   else if (target_attr == -1)
+     {
+       /* Target doesn't exist, and source is not a directory:
+ 	 _rename() must be good enough.  */
+       simple_should_do = 1;
+     }
  
    /* On to some REAL work for a change.  Let DOS do the simple job:
       moving a regular file, or renaming a directory.  Note that on

- Raw text -


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