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

[cdi-devel] [PATCH] iso9660: Fix resource flags



It's not a very good idea to flag every resource as readable, browsable
and symlink-readable at the same time. This fixes the flags to actually
match the assigned class.

The iso9660 driver knows symlinks as it reads them from a Rockridge
image, however it doesn't implement the .read_link callback, so using
the respective flag doesn't make sense. Treat symlinks as regular files
for now.

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 iso9660/res.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/iso9660/res.c b/iso9660/res.c
index 1763db1..7180eed 100644
--- a/iso9660/res.c
+++ b/iso9660/res.c
@@ -45,12 +45,26 @@ struct iso9660_fs_res *iso9660_fs_res_create(const char *name,struct iso9660_fs_
   res->res.parent = (struct cdi_fs_res*)parent;
   res->class = class;
   res->res.type = type;
-  if (class==CDI_FS_CLASS_DIR) res->res.dir = &iso9660_fs_res_dir;
-  else res->res.file = &iso9660_fs_res_file;
-  res->res.flags.read = 1;
-  res->res.flags.execute = 1;
-  res->res.flags.browse = 1;
-  res->res.flags.read_link = 1;
+
+    switch (class) {
+        case CDI_FS_CLASS_DIR:
+            res->res.dir = &iso9660_fs_res_dir;
+            res->res.flags.browse = 1;
+            break;
+#if 0
+        case CDI_FS_CLASS_LINK:
+            res->res.link = &iso9660_fs_res_link;
+            res->res.flags.read_link = 1;
+            break;
+#endif
+        case CDI_FS_CLASS_FILE:
+        case CDI_FS_CLASS_SPECIAL:
+        default:
+            res->res.file = &iso9660_fs_res_file;
+            res->res.flags.read = 1;
+            res->res.flags.execute = 1;
+            break;
+    }
 
   if (parent!=NULL) {
     res->voldesc = parent->voldesc;
-- 
1.7.7