In the latter case, both functions return a value of zero (i.e. success) but
the operation actually fails. The problem may be specific to NetWare 6.5
SP2/SP3/SP4/SP5 (I remember vaguely -- but I didn't test it now -- that
NetWare 6 and NetWare 6.5 SP0/SP1 don't show up this problem).
Does anybody know about a solution (or at least a workaround)? Thanks!
Robert
"Robert Hochenburger" <NO.ho...@cnw.SPAM.hu> wrote in
news:0eFNf.2020$oh5...@prv-forum2.provo.novell.com:
> In the latter case, both functions return a value of zero (i.e. success)
> but the operation actually fails. The problem may be specific to NetWare
> 6.5 SP2/SP3/SP4/SP5 (I remember vaguely -- but I didn't test it now --
> that NetWare 6 and NetWare 6.5 SP0/SP1 don't show up this problem).
I would like to ask you if you can test with SP5 again; there were fixes in
the OS which may be related....
Guenter.
You are right: my post was vague. Please let me clarify:
- NetWare 6.5 SP5/SP4 (these are my current test servers) definitely show up
the problem
- I guess (but I am not sure) that NetWare 6.5 SP3/SP2 show it up, too
- I guess (but I am not sure) that NetWare 6.5 SP1/SP0 and NetWare 6 don't
show it up
B.t.w. the problem can be easily reproduced in the case that you Novell
gurus of this newsgroup wish to take a look at it ... ;-)
Greetings,
Robert
"Guenter" <devf...@novell.com> wrote in message
news:bTWNf.2795$oh5...@prv-forum2.provo.novell.com...
> Hi Robert,
> B.t.w. the problem can be easily reproduced in the case that you Novell
> gurus of this newsgroup wish to take a look at it ... ;-)
sure, but nevertheless it helps a lot and speeds up any needed fixing if you
post here a small but complete test prog which demonstrates the problem --
then its very easy for someone else to pick up your sample and confirm that
we have a problem; and then the fix might not be so far away.....
(source is sufficient - NLM not needed)
otherwise the one who wants to check this has to read through the docs, look
at those APIs, and code something self which takes much more time....
Guenter.
Sorry if you felt my reply was offensive -- it was not meant to be. Please
find below
- the sample code (got rid of all 'include <...>' statements)
- the output I just generated on a NetWare 6.5 SP5 server
Greetings,
Robert
###########################################################
int close (int);
void ConsolePrintf (char *format, ...);
int DOSChangeFileMode (char *, int *, int, int);
int DOSRename (char *, char *);
void exit (int);
char * mkdir (char *);
int open (char *, int);
int rename (char *, char *);
int write (int, char *, int);
#define O_RDONLY 0x0000
#define O_RDWR 0x0002
#define O_CREAT 0x0020
static void create_dir (char *path)
{
if (mkdir (path)) {
ConsolePrintf ("Can't create directory %s\n", path);
exit (1);
}
ConsolePrintf ("Directory %s created\n", path);
}
static void create_file (char *path)
{
int dummy, handle = open (path, O_RDWR | O_CREAT);
if (handle == -1 || write (handle, "abc", 3) != 3 || close (handle)) {
ConsolePrintf ("Can't create file %s\n", path);
exit (1);
}
DOSChangeFileMode (path, &dummy, 1, 0); // set file to read-write since
it may be created as read-only
ConsolePrintf ("File %s created\n", path);
}
static void existence (char *file1, char *file2)
{
int handle, exists1 = 0, exists2 = 0;
handle = open (file1, O_RDONLY);
if (handle != -1) {
exists1 = 1;
close (handle);
}
handle = open (file2, O_RDONLY);
if (handle != -1) {
exists2 = 1;
close (handle);
}
ConsolePrintf ("afterward %s %s, %s %s\n", file1, exists1 ? "exists" :
"doesn't exist",
file2, exists2 ? "exists" : "doesn't exist");
if (!exists1 && exists2) {
ConsolePrintf ("*** rename operation succeeded ***\n");
}
if (exists1 && !exists2) {
ConsolePrintf ("*** move operation failed ***\n");
}
}
static void do_DOSRename (char *src, char *dst)
{
int status;
status = DOSRename (src, dst);
ConsolePrintf ("\nDOSRename (%s, %s) returns %d\n", src, dst, status);
existence (src, dst);
}
static void do_rename (char *src, char *dst)
{
int status;
status = rename (src, dst);
ConsolePrintf ("\nrename (%s, %s) returns %d\n", src, dst, status);
existence (src, dst);
}
void main (int argc, char **argv)
{
create_dir ("C:\\DIR1");
create_dir ("C:\\DIR2");
create_file ("C:\\DIR1\\TEST_1.TXT");
create_file ("C:\\DIR1\\TEST_2.TXT");
do_DOSRename ("C:\\DIR1\\TEST_1.TXT", "C:\\DIR1\\TEST_A.TXT");
do_rename ("C:\\DIR1\\TEST_2.TXT", "C:\\DIR1\\TEST_B.TXT");
do_DOSRename ("C:\\DIR1\\TEST_A.TXT", "C:\\DIR2\\TEST_A.TXT");
do_rename ("C:\\DIR1\\TEST_B.TXT", "C:\\DIR2\\TEST_B.TXT");
}
###########################################################
Directory C:\DIR1 created
Directory C:\DIR2 created
File C:\DIR1\TEST_1.TXT created
File C:\DIR1\TEST_2.TXT created
DOSRename (C:\DIR1\TEST_1.TXT, C:\DIR1\TEST_A.TXT) returns 0
afterward C:\DIR1\TEST_1.TXT doesn't exist, C:\DIR1\TEST_A.TXT exists
*** rename operation succeeded ***
rename (C:\DIR1\TEST_2.TXT, C:\DIR1\TEST_B.TXT) returns 0
afterward C:\DIR1\TEST_2.TXT doesn't exist, C:\DIR1\TEST_B.TXT exists
*** rename operation succeeded ***
DOSRename (C:\DIR1\TEST_A.TXT, C:\DIR2\TEST_A.TXT) returns 0
afterward C:\DIR1\TEST_A.TXT exists, C:\DIR2\TEST_A.TXT doesn't exist
*** move operation failed ***
rename (C:\DIR1\TEST_B.TXT, C:\DIR2\TEST_B.TXT) returns 0
afterward C:\DIR1\TEST_B.TXT exists, C:\DIR2\TEST_B.TXT doesn't exist
*** move operation failed ***
###########################################################
"Guenter" <devf...@novell.com> wrote in message
news:RXDPf.7131$oh5....@prv-forum2.provo.novell.com...