]> wimlib.net Git - wimlib/blobdiff - src/mount_image.c
mount_image.c: Use well-defined check in flags_writable()
[wimlib] / src / mount_image.c
index 7b3a91470d7c7c5c6b57df3412a4f49bf6dd9b52..586722e50fc84fb25c27f1a127583b8a4d6c4da5 100644 (file)
@@ -164,7 +164,8 @@ get_lookup_flags(const struct wimfs_context *ctx)
 static inline int
 flags_writable(int open_flags)
 {
-       return open_flags & (O_RDWR | O_WRONLY);
+       int accmode = (open_flags & O_ACCMODE);
+       return (accmode == O_RDWR || accmode == O_WRONLY);
 }
 
 /*
@@ -667,6 +668,7 @@ extract_resource_to_staging_dir(struct wim_inode *inode,
                }
        }
 
+       lte_put_resource(new_lte);
        new_lte->refcnt              = inode->i_nlink;
        new_lte->resource_location   = RESOURCE_IN_STAGING_FILE;
        new_lte->staging_file_name   = staging_file_name;