diff options
author | Damien Zammit <damien@zamaudio.com> | 2024-03-04 00:25:50 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-03-04 00:25:50 +0100 |
commit | eb1dc8ae5e7cd683d082d2278bc79a04047c7102 (patch) | |
tree | 284fc6ef01d23662e175faf245fb1ef5cda3a700 /ext2fs | |
parent | 8734aa9a0a81da90520114b207d1e541ec1fa063 (diff) | |
download | hurd-eb1dc8ae5e7cd683d082d2278bc79a04047c7102.tar.gz hurd-eb1dc8ae5e7cd683d082d2278bc79a04047c7102.tar.bz2 hurd-eb1dc8ae5e7cd683d082d2278bc79a04047c7102.zip |
ext2fs: Check that the filesystem supports xattr before reading it
Diffstat (limited to 'ext2fs')
-rw-r--r-- | ext2fs/inode.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/ext2fs/inode.c b/ext2fs/inode.c index 5b99069e..ead82678 100644 --- a/ext2fs/inode.c +++ b/ext2fs/inode.c @@ -764,19 +764,24 @@ diskfs_get_translator (struct node *np, char **namep, mach_msg_type_number_t *na return err; } - err = ext2_get_xattr (np, "gnu.translator", NULL, &datalen); - if (err) - return err; + /* If xattr is supported by this filesystem, check for new translator record + * regardless of flag to use it or not */ + if (EXT2_HAS_COMPAT_FEATURE (sblock, EXT2_FEATURE_COMPAT_EXT_ATTR)) + { + err = ext2_get_xattr (np, "gnu.translator", NULL, &datalen); + if (err) + return err; - *namep = malloc (datalen); - if (!*namep) - err = ENOMEM; - else - err = ext2_get_xattr (np, "gnu.translator", *namep, &datalen); + *namep = malloc (datalen); + if (!*namep) + err = ENOMEM; + else + err = ext2_get_xattr (np, "gnu.translator", *namep, &datalen); - diskfs_end_catch_exception (); + diskfs_end_catch_exception (); - *namelen = datalen; + *namelen = datalen; + } return err; } |