New return value 4 of iso_local_get_lfa_flags(): file does not have lfa_flags

This commit is contained in:
Thomas Schmitt 2024-08-06 19:05:07 +02:00
parent cc1884a0cb
commit 7fc7d65e05
4 changed files with 18 additions and 4 deletions

View File

@ -452,7 +452,7 @@ try_lfa_flags:;
if(!(flag & 64)) {
ret= aaip_get_lfa_flags(path, &lfa_flags, &max_bit, &os_errno, 0);
if(ret > 0) {
if(ret == 1 || ret == 2) {
ret= aaip_encode_lfa_flags(lfa_flags, lfa_value, &lfa_length, 0);
if(ret > 0) {
(*names)[*num_attrs]= strdup("isofs.fa");
@ -520,10 +520,13 @@ ex:;
@param lfa_flags Will get filled with the FS_*_FL
@param max_bit Will tell the highest bit that is possibly set
(-1 = surely no bit is valid)
@param flag Bitfield for control purposes. Submit 0.
@param flag Bitfield for control purposes.
bit0= consider ENOTTY from FS_IOC_GETFLAGS an error
(else return 4 on ENOTTY)
@return 1= ok, all local attribute flags are in lfa_flags
2= ok, but some local flags could not be mapped to
the FS_*_FL bits
4= ok, ENOTTY from FS_IOC_GETFLAGS
0= local flag retrieval not enabled at compile time
<0 error with system calls
*/
@ -552,6 +555,11 @@ int aaip_get_lfa_flags(char *path, uint64_t *lfa_flags, int *max_bit,
ret= ioctl(fd, FS_IOC_GETFLAGS, &ioctl_result);
close(fd);
if(ret == -1) {
if(errno == ENOTTY && !(flag & 1)) {
/* Usual result with file type or filesystem without Linux attributes */
*max_bit= 23;
return(4);
}
aaip_local_error("ioctl(FS_IOC_GETFLAGS)", path, errno, 0);
*os_errno= errno;
return(-1);

View File

@ -953,6 +953,9 @@ int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag)
* 1= ok, lfa_flags is valid
* 2= ok, but some local flags could not be mapped to the FS_*_FL bits
* 3= ok, symbolic link encountered, flag bit5 not set, lfa_flags set to 0
* 4= ok, file did not bear attribute flags. E.g. because not S_IFDIR or
* S_IFREG, or because unsuitable filesystem.
* lfa_flags is set to 0
* 0= local flags retrieval not enabled at compile time
* <0= error with system calls
*/

View File

@ -8062,6 +8062,9 @@ int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
* 1 = ok, lfa_flags is valid
* 2 = ok, but some local flags could not be mapped to the FS_*_FL bits
* 3 = ok, symbolic link encountered, flag bit5 not set,lfa_flags set to 0
* 4 = ok, file did not bear attribute flags. E.g. because not S_IFDIR or
* S_IFREG, or because unsuitable filesystem.
* lfa_flags is set to 0
* <0 = error
*
* @since 1.5.8

View File

@ -393,10 +393,10 @@ const char *iso_error_to_msg(int errcode)
return "Error with decoding AAIP info for ACL or xattr";
case ISO_AAIP_NO_GET_LOCAL:
case ISO_AAIP_NO_GET_LOCAL_S:
return "Error with reading ACL or xattr from local file";
return "Error with reading ACL or other attributes from local file";
case ISO_AAIP_NO_SET_LOCAL:
case ISO_AAIP_NO_SET_LOCAL_S:
return "Error with attaching ACL or xattr to local file";
return "Error with attaching ACL or other attributes to local file";
case ISO_AAIP_NON_USER_NAME:
return "Unallowed attempt to set an xattr with non-userspace name";
case ISO_EXTF_TOO_OFTEN: