]> xenbits.xensource.com Git - libvirt.git/commitdiff
src: stop using O_DIRECTORY in resctrl
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 22 Jan 2020 11:42:18 +0000 (11:42 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 29 Jan 2020 14:51:40 +0000 (14:51 +0000)
The O_DIRECTORY flag causes open() to return an error
if the filename is a directory. There's no obvious
reason why resctrl needs to use this, while the rest of
libvirt code does not. Removing it avoids build issues
on platforms where O_DIRECTORY is not defined, once we
remove GNULIB.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/util/virresctrl.c

index 684d2ce398191c3abbd35fdb572915b6944bac48..e9bcdb44b10d312d0cfb224edf5374a2c7a82324 100644 (file)
@@ -455,7 +455,7 @@ VIR_ONCE_GLOBAL_INIT(virResctrl);
 static int
 virResctrlLockWrite(void)
 {
-    int fd = open(SYSFS_RESCTRL_PATH, O_DIRECTORY | O_CLOEXEC);
+    int fd = open(SYSFS_RESCTRL_PATH, O_RDWR | O_CLOEXEC);
 
     if (fd < 0) {
         virReportSystemError(errno, "%s", _("Cannot open resctrl"));