]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virSecurityDACSetOwnershipInternal: Fix WIN32 code
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Jun 2021 08:24:46 +0000 (10:24 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 17 Jun 2021 13:49:12 +0000 (15:49 +0200)
I must admit, I have no idea why we build such POSIX dependent
code as DAC driver for something such not POSIX as WIN32. Anyway,
the code which is supposed to set error is not doing that. The
proper way is to mimic what chown() does:

  On error, -1 is returned, and errno is set to indicate the error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/security/security_dac.c

index 603d5b98ef5f08e0c89962daa7a3f3a7fac5042d..7ba367755a8bb3f49a5c11eba33f5ed2409d05b9 100644 (file)
@@ -700,7 +700,8 @@ virSecurityDACSetOwnershipInternal(const virSecurityDACData *priv,
         }
 
 #ifdef WIN32
-        rc = ENOSYS;
+        rc = -1;
+        errno = ENOSYS;
 #else /* !WIN32 */
         rc = chown(path, uid, gid);
 #endif /* !WIN32 */