Subject: Re: bug#41463: 27.0.91; ACL error on Windows when trying to save file

From: Eli Zaretskii <[email-masked]>
Date: Sat, 23 May 2020 08:52:49 +0300

> Date: Sat, 23 May 2020 08:43:40 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > I traced this to acl_get_file() in w32.c where GetLastError() returns
> > 50, i.e. ERROR_NOT_SUPPORTED.
> 
> Thanks.  Does the patch below fix this problem?

Actually, please use this more thorough patch instead:

diff --git a/src/w32.c b/src/w32.c
index 62c53fd..78e75f0 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -6398,7 +6398,15 @@ acl_get_file (const char *fname, acl_type_t type)
 	      if (!get_file_security (fname, si, psd, sd_len, &sd_len))
 		{
 		  xfree (psd);
-		  errno = EIO;
+		  err = GetLastError ();
+		  if (err == ERROR_NOT_SUPPORTED)
+		    errno = ENOTSUP;
+		  else if (err == ERROR_FILE_NOT_FOUND
+			   || err == ERROR_PATH_NOT_FOUND
+			   || err == ERROR_INVALID_NAME)
+		    errno = ENOENT;
+		  else
+		    errno = EIO;
 		  psd = NULL;
 		}
 	    }
@@ -6409,6 +6417,8 @@ acl_get_file (const char *fname, acl_type_t type)
 		      be encoded in the current ANSI codepage. */
 		   || err == ERROR_INVALID_NAME)
 	    errno = ENOENT;
+	  else if (err == ERROR_NOT_SUPPORTED)
+	    errno = ENOTSUP;
 	  else
 	    errno = EIO;
 	}