Mail Archives: cygwin/1999/06/23/16:28:31
When rmdir() attempts to remove a regular file (non-directory) and therefore
fails, it sets errno to EISDIR instead of ENOTDIR. Tested on NT with B20.1;
both egcs-2.91.57 and egcs-2.91.66; with binmode and without. Couldn't find
a reference to the problem in the mailing list archives and didn't see an
obvious way of fixing it in the source. Encountered the problem when porting
dpkg. Test code below...
-Tad
----- begin chkrmdir.c -----
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define TEST_FNAME "rmdir_test_file"
int main() {
FILE *f;
printf ("Creating '%s'.\n", TEST_FNAME);
if (!(f = fopen(TEST_FNAME,"w"))) {
fprintf(stderr, "fopen '%s' failed: %s (%d)\n",
TEST_FNAME, strerror(errno), errno);
exit(1);
}
fputc('X',f);
fclose(f);
printf ("Trying rmdir on '%s'.\n", TEST_FNAME);
if (rmdir (TEST_FNAME))
fprintf(stderr, "rmdir '%s' failed: %s (%d)\n",
TEST_FNAME, strerror(errno), errno);
printf ("Trying unlink on '%s'.\n", TEST_FNAME);
if (unlink (TEST_FNAME))
fprintf(stderr, "unlink %s failed: '%s' (%d)\n",
TEST_FNAME, strerror(errno), errno);
exit(0);
}
----- end chkrmdir.c -----
--
------------------------------------------------------------------------------
Thaddeus J. Kollar
Integral Systems, Inc.
NASA John H. Glenn Research Center, M/S 142-2
------------------------------------------------------------------------------
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -