* fhandler_disk_file.cc (fhandler_base::fstat_helper): Workaround
another bug in NWFS. Add comment to explain why. Improve debug output in case the NT calls to test for binary fail. * path.h (path_conv::fs_is_cifs): New method. (path_conv::fs_is_nwfs): New method.
This commit is contained in:
		| @@ -1,3 +1,11 @@ | ||||
| 2010-02-03  Corinna Vinschen  <corinna@vinschen.de> | ||||
|  | ||||
| 	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Workaround | ||||
| 	another bug in NWFS.  Add comment to explain why.  Improve debug output | ||||
| 	in case the NT calls to test for binary fail. | ||||
| 	* path.h (path_conv::fs_is_cifs): New method. | ||||
| 	(path_conv::fs_is_nwfs): New method. | ||||
|  | ||||
| 2010-02-02  Corinna Vinschen  <corinna@vinschen.de> | ||||
|  | ||||
| 	* include/paths.h (_PATH_MNTTAB): Define. | ||||
|   | ||||
| @@ -659,27 +659,46 @@ fhandler_base::fstat_helper (struct __stat64 *buf, | ||||
| 	  if (pc.exec_state () == dont_know_if_executable) | ||||
| 	    { | ||||
| 	      OBJECT_ATTRIBUTES attr; | ||||
| 	      NTSTATUS status; | ||||
| 	      HANDLE h; | ||||
| 	      IO_STATUS_BLOCK io; | ||||
|  | ||||
| 	      InitializeObjectAttributes (&attr, &ro_u_empty, 0, get_handle (), | ||||
| 					  NULL); | ||||
| 	      if (NT_SUCCESS (NtOpenFile (&h, SYNCHRONIZE | FILE_READ_DATA, | ||||
| 					  &attr, &io, FILE_SHARE_VALID_FLAGS, | ||||
| 					  FILE_SYNCHRONOUS_IO_NONALERT))) | ||||
| 	      /* The NWFS implementation is frighteningly incomplete.  When | ||||
| 	         re-opening a file by handle, the subsequent NtReadFile | ||||
| 		 returns with the weird status STATUS_FILE_IS_A_DIRECTORY. | ||||
| 		 We're still using the re-open by handle method for all | ||||
| 		 other filesystems since it's 8-10% faster than opening | ||||
| 		 by name. */ | ||||
| 	      if (pc.fs_is_nwfs ()) | ||||
| 		InitializeObjectAttributes (&attr, pc.get_nt_native_path (), | ||||
| 					    OBJ_CASE_INSENSITIVE, NULL, NULL) | ||||
| 	      else | ||||
| 		InitializeObjectAttributes (&attr, &ro_u_empty, 0, | ||||
| 					    get_handle (), NULL); | ||||
| 	      status = NtOpenFile (&h, SYNCHRONIZE | FILE_READ_DATA, | ||||
| 				   &attr, &io, FILE_SHARE_VALID_FLAGS, | ||||
| 				   FILE_SYNCHRONOUS_IO_NONALERT); | ||||
| 	      if (NT_SUCCESS (status)) | ||||
| 		{ | ||||
| 		  LARGE_INTEGER off = { QuadPart:0LL }; | ||||
| 		  char magic[3]; | ||||
|  | ||||
| 		  if (NT_SUCCESS (NtReadFile (h, NULL, NULL, NULL, &io, magic, | ||||
| 					      3, &off, NULL)) | ||||
| 		  status = NtReadFile (h, NULL, NULL, NULL, &io, magic, | ||||
| 				       3, &off, NULL); | ||||
| 		  if (NT_SUCCESS (status) | ||||
| 		      && has_exec_chars (magic, io.Information)) | ||||
| 		    { | ||||
| 		      pc.set_exec (); | ||||
| 		      buf->st_mode |= STD_XBITS; | ||||
| 		    } | ||||
| 		  else | ||||
| 		    debug_printf ("%p = NtReadFile(%S)", status, | ||||
| 				  pc.get_nt_native_path ()); | ||||
| 		  NtClose (h); | ||||
| 		} | ||||
| 	      else | ||||
| 		debug_printf ("%p = NtOpenFile(%S)", status, | ||||
| 			      pc.get_nt_native_path ()); | ||||
| 	    } | ||||
| 	} | ||||
|       if (pc.exec_state () == is_executable) | ||||
|   | ||||
| @@ -234,6 +234,8 @@ class path_conv | ||||
|   bool fs_is_netapp () const {return fs.is_netapp ();} | ||||
|   bool fs_is_cdrom () const {return fs.is_cdrom ();} | ||||
|   bool fs_is_mvfs () const {return fs.is_mvfs ();} | ||||
|   bool fs_is_cifs () const {return fs.is_cifs ();} | ||||
|   bool fs_is_nwfs () const {return fs.is_nwfs ();} | ||||
|   ULONG fs_serial_number () const {return fs.serial_number ();} | ||||
|   inline const char *set_path (const char *p) | ||||
|   { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user