------- Comment #1 from toon at moene dot org 2009-09-17 13:26 ------- Perhaps the system call 'access' can provide help here.
>From the man page (man 2 access): access() checks whether the calling process can access the file pathname. If pathname is a symbolic link, it is dereferenced. The mode specifies the accessibility check(s) to be performed, and is either the value F_OK, or a mask consisting of the bitwise OR of one or more of R_OK, W_OK, and X_OK. F_OK tests for the existence of the file. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41387