Mail Archives: djgpp-workers/2001/01/19/10:16:58
Eli wrote:
> So, what happens if you simply try to rename e:/djgpp/tmp/foo to
> e:/temp/bar with a simple call to _rename on that machine, and
> e:/temp/bar already exists? Does it fail with the same error code
> 183? And what happens if e:/temp/bar does not exist?
>
> (I'm trying to figure out whether there's a general problem with
> _rename on W2K, or maybe Patch does something that prevents _rename
> from working correctly.)
Testing shows that _rename gives an error when the targetfile already
exists.
I used the little program (TMPDIR points to e:/djgpp/tmp/, current dir is
e:\temp):
--- Code ---
#include <stdio.h>
#include <errno.h>
int main() {
int i;
_doserrno = 0; i= _rename("hoi.txt", "hoi1.txt");
printf("ren: hoi.txt hoi1.txt -- %d, 0x%X\n", i, _doserrno);
_doserrno = 0; i= _rename("hoi1.txt", "hoi2.txt");
printf("ren: hoi1.txt hoi2.txt -- %d, 0x%X\n", i, _doserrno);
_doserrno = 0; i= _rename("hoi2.txt", "e:\\temp\\2\\hoi3.txt");
printf("ren: hoi2.txt e:\\temp\\2\\hoi3.txt -- %d, 0x%X\n", i, _doserrno);
_doserrno = 0; i= _rename("e:\\temp\\2\\hoi3.txt",
"e:\\temp\\2\\hoi4.txt");
printf("ren: e:\\temp\\2\\hoi3.txt e:\\temp\\2\\hoi4.txt -- %d, 0x%X\n",
i, _doserrno);
_doserrno = 0; i= _rename("e:\\temp\\2\\hoi4.txt", "hoi5.txt");
printf("ren: e:\\temp\\2\\hoi4.txt hoi5.txt -- %d, 0x%X\n", i, _doserrno);
return 0;
}
--- End Code ---
And it always fails (with -1) if the target already exists, or the source
doesn't exist. It always gives _doserrno=0xB7 if target exists, and 0x2 if
source doesn't exist.
> > I think I'll try using the NTLFN package as well, maybe it matters.
> This is not worth your effort: NTLFN replaces the LFN API with its own
> code, which is known to work, and we already established that this
> failure is somehow connected with W2K's LFN functions.
O, no, it IS worth the effort (although it doesn't help solving the problem,
I
admit that), because now I know there is a way to have my programs working
like they should. And all the effort was just a: lfnload & patch -i dif.dif.
Not so
much, if I may say so...
This is all the information one might need, I think.
Greetings,
Robert
- Raw text -