This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

inconsistency in 'access' function between /cygdrive/c and c:/


The following issue was reported to me. I've reproduced it on Cygwin 2 and 3, on a couple of machines.

When using paths beginning 'C:/' the 'access' function claims that directories are readable when they are not. The same problem does not arise when starting the same directory name with '/cygdrive/c/'. I attach a minimal example program showing the problem. When I run it it returns that both ways of naming 'System Volume Information' exist, but that 'C:/System Volume Information' can be Read (which is wrong), while '/cygdrive/c/System Volume Information' can't be Read.


#include <unistd.h>
#include <stdio.h>

int main(void) {
    int ok1 = access("C:/System Volume Information/", F_OK);
    int ok2 = access("/cygdrive/c/System Volume Information", F_OK);
    int read1 = access("C:/System Volume Information/", R_OK);
    int read2 = access("/cygdrive/c/System Volume Information", R_OK);

    printf("%d,%d\n%d,%d\n", ok1, read1, ok2, read2);
}

// Prints
0,0
0,-1
 

Attachment: cygcheck.out
Description: cygcheck.out

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]