[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Allow sticky bit to be read and set.



---
 src/conf/storage_conf.c       |    8 +++++---
 src/storage/storage_backend.c |    2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 3132aae..017648d 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -667,7 +667,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
     } else {
         int tmp;
 
-        if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 || (tmp & ~0777)) {
+        if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 ||
+            (tmp & ~(S_ISVTX | S_IRWXUGO))) {
             VIR_FREE(mode);
             virReportError(VIR_ERR_XML_ERROR,
                            "%s", _("malformed octal mode"));
@@ -1037,7 +1038,7 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) {
 
         virBufferAddLit(&buf,"    <permissions>\n");
         virBufferAsprintf(&buf,"      <mode>0%o</mode>\n",
-                          def->target.perms.mode);
+                          def->target.perms.mode & (S_ISVTX | S_IRWXUGO));
         virBufferAsprintf(&buf,"      <owner>%d</owner>\n",
                           (int) def->target.perms.uid);
         virBufferAsprintf(&buf,"      <group>%d</group>\n",
@@ -1290,7 +1291,8 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
 
     virBufferAddLit(buf,"    <permissions>\n");
     virBufferAsprintf(buf,"      <mode>0%o</mode>\n",
-                      def->perms.mode);
+                      def->perms.mode &
+                      (S_ISVTX | S_IRWXUGO));
     virBufferAsprintf(buf,"      <owner>%u</owner>\n",
                       (unsigned int) def->perms.uid);
     virBufferAsprintf(buf,"      <group>%u</group>\n",
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index df3833a..5fd14ed 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1210,7 +1210,7 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
         }
     }
 
-    target->perms.mode = sb.st_mode & S_IRWXUGO;
+    target->perms.mode = sb.st_mode & (S_ISVTX | S_IRWXUGO);
     target->perms.uid = sb.st_uid;
     target->perms.gid = sb.st_gid;
 
-- 
1.7.8.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]