Mail Archives: cygwin/1997/02/21/10:11:17
Gentlemen:
The 'unlink' call in b17.1, when applied to a directory, neither
performs an implicit 'rmdir' (which it is theoretically allowed to do if
the calling user is "root" -- perhaps that means "Administrator" under
WinNT?), nor returns an error code nor sets 'errno' in such a situation.
Some code (the generic port of CVS to WinNT, in particular), relies on
the error return of 'unlink' as an implicit 'isdir' call when told to
unlink a generic filespec.
I understand that such code is poor practice, and I have corrected the
situation in my version of the CVS source, but such practice does exist
and will be encountered when porting software to GNU-Win32.
In any case, an error should be returned if the call to 'unlink' did
nothing to a directory. Under WinNT, such a call on "native" compilers
generally returns EACCES; under Win95 it returns ENOENT. I would agree
that this difference in behavior should be removed and standardized on
whatever error code various flavors of Unix would return.
Test code is as follows:
====start unlink_bug.c=============================================
#include <stdio.h>
#include <errno.h>
int main(int argc, char* argv[]) {
int status;
if (argc != 2) {
fprintf(stderr, "usage: %s <dir>\n", argv[0]);
return 1;
}
status = unlink(argv[1]);
printf("unlink(%s) == %d errno == %d\n",argv[1], status,
errno);
return status;
}
====end unlink_bug.c=============================================
Thank you for an excellent tool which shows much promise to keep
improving.
Victor J. Griswold, D.Sc.
Aironet Wireless Communications, Inc.
voice: 330-664-7987
fax: 330-664-7301
email: (MS-Mail) vgris AT aironet DOT com
(MIME) Victor DOT Griswold AT pobox DOT com
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -