This is the mail archive of the cygwin-patches@sourceware.cygnus.com 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]

Files with system bit set.


Hi,

I want to suggest the following patch.

Problem:
Files with system attribute set are opened to see if they
are symlinks. If the file can't be opened by the caller,
an error is returned to the application:

	$ cmd /c attrib foo
	A S foo
	$ ls -l foo
	--wx------ 1 corinna users [...] foo
	$ chmod 666 foo
	chmod: foo: Bad file number.

Reason:
When CreateFileA in symlink::info() fails, errno is set
and the function is left.

This seems to be not correct because symlinks are readable
for everyone in UX like systems as in cygwin:

	-rwxrwxrwx 1 corinna users [...] sl_foo -> foo

Solution:
Treat the file as a non symlink file.

Corinna


ChangeLog:
==========

	* path.cc (symlink::info): Treat non readable files
	as normal non symlink files.
Index: path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.20
diff -u -p -r1.20 path.cc
--- path.cc	2000/05/04 19:46:32	1.20
+++ path.cc	2000/05/08 20:38:29
@@ -2177,7 +2177,7 @@ symlink_info::check (const char *in_path
 		       FILE_ATTRIBUTE_NORMAL, 0);
       res = -1;
       if (h == INVALID_HANDLE_VALUE)
-	__seterrno ();
+	goto file_not_symlink;
       else
 	{
 	  char cookie_buf[sizeof (SYMLINK_COOKIE) - 1];

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