Replace all le32 zero test conditions with "le32_cmpz(...)".
parent
18990412fa
commit
ed87a4dffa
|
@ -455,7 +455,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
|
|||
a->flags = 0;
|
||||
|
||||
if (le32_eq(type, AT_DATA)
|
||||
&& (a->non_resident ? !a->initialized_size : !a->value_length)) {
|
||||
&& (a->non_resident ? !a->initialized_size : le32_cmpz(a->value_length))) {
|
||||
/*
|
||||
* Define/redefine the compression state if stream is
|
||||
* empty, based on the compression mark on parent
|
||||
|
@ -2779,7 +2779,7 @@ static int ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name,
|
|||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
if (!a->length)
|
||||
if (le32_cmpz(a->length))
|
||||
break;
|
||||
/* If this is an enumeration return this attribute. */
|
||||
if (le32_eq(type, AT_UNUSED))
|
||||
|
@ -3182,7 +3182,7 @@ do_next_attr_loop:
|
|||
break;
|
||||
if (le32_eq(a->type, AT_END))
|
||||
continue;
|
||||
if (!a->length)
|
||||
if (le32_cmpz(a->length))
|
||||
break;
|
||||
if (!le16_eq(al_entry->instance, a->instance))
|
||||
goto do_next_attr;
|
||||
|
@ -3516,7 +3516,7 @@ ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol,
|
|||
{
|
||||
ATTR_DEF *ad;
|
||||
|
||||
if (!vol || !vol->attrdef || !type) {
|
||||
if (!vol || !vol->attrdef || le32_cmpz(type)) {
|
||||
errno = EINVAL;
|
||||
ntfs_log_perror("%s: type=%d", __FUNCTION__, type);
|
||||
return NULL;
|
||||
|
@ -3679,7 +3679,7 @@ static int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE
|
|||
*/
|
||||
int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type)
|
||||
{
|
||||
if (!vol || !vol->attrdef || !type) {
|
||||
if (!vol || !vol->attrdef || le32_cmpz(type)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1567,7 +1567,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
if (!securid) {
|
||||
if (le32_cmpz(securid)) {
|
||||
if (ntfs_sd_add_everyone(ni)) {
|
||||
err = errno;
|
||||
goto err_out;
|
||||
|
|
|
@ -710,7 +710,7 @@ static le32 entersecurityattr(ntfs_volume *vol,
|
|||
size = le32_to_cpu(psii->datasize);
|
||||
}
|
||||
entry = next;
|
||||
if (!entry && !keyid && !retries) {
|
||||
if (!entry && le32_cmpz(keyid) && !retries) {
|
||||
/* search failed, retry from smallest key */
|
||||
ntfs_index_ctx_reinit(xsii);
|
||||
found = !ntfs_index_lookup((char*)&keyid,
|
||||
|
@ -740,7 +740,7 @@ static le32 entersecurityattr(ntfs_volume *vol,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!keyid) {
|
||||
if (le32_cmpz(keyid)) {
|
||||
/*
|
||||
* could not find any entry, before creating the first
|
||||
* entry, make a double check by making sure size of $SII
|
||||
|
@ -756,7 +756,7 @@ static le32 entersecurityattr(ntfs_volume *vol,
|
|||
}
|
||||
ntfs_attr_close(na);
|
||||
}
|
||||
if (!securid) {
|
||||
if (le32_cmpz(securid)) {
|
||||
ntfs_log_error("Error creating a security_id\n");
|
||||
errno = EIO;
|
||||
}
|
||||
|
@ -2963,7 +2963,7 @@ int ntfs_set_owner_mode(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
|
|||
}
|
||||
#if CACHE_LEGACY_SIZE
|
||||
/* also invalidate legacy cache */
|
||||
if (isdir && !ni->security_id) {
|
||||
if (isdir && le32_cmpz(ni->security_id)) {
|
||||
struct CACHED_PERMISSIONS_LEGACY legacy;
|
||||
|
||||
legacy.mft_no = ni->mft_no;
|
||||
|
@ -3215,7 +3215,7 @@ int ntfs_set_ntfs_acl(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
|
|||
* failed.
|
||||
*/
|
||||
if ((ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)
|
||||
&& !ni->security_id) {
|
||||
&& le32_cmpz(ni->security_id)) {
|
||||
struct CACHED_PERMISSIONS_LEGACY legacy;
|
||||
|
||||
legacy.mft_no = ni->mft_no;
|
||||
|
@ -4048,7 +4048,7 @@ le32 ntfs_inherited_id(struct SECURITY_CONTEXT *scx,
|
|||
* Not cached or not available in cache, compute it all
|
||||
* Note : if parent directory has no id, it is not cacheable
|
||||
*/
|
||||
if (!securid) {
|
||||
if (le32_cmpz(securid)) {
|
||||
parentattr = getsecurityattr(scx->vol, dir_ni);
|
||||
if (parentattr) {
|
||||
securid = build_inherited_id(scx,
|
||||
|
@ -4926,10 +4926,10 @@ int ntfs_set_file_security(struct SECURITY_API *scapi,
|
|||
attrsz = ntfs_attr_size(attr);
|
||||
/* if selected, owner and group must be present or defaulted */
|
||||
missing = ((selection & OWNER_SECURITY_INFORMATION)
|
||||
&& !phead->owner
|
||||
&& le32_cmpz(phead->owner)
|
||||
&& !(phead->control & SE_OWNER_DEFAULTED))
|
||||
|| ((selection & GROUP_SECURITY_INFORMATION)
|
||||
&& !phead->group
|
||||
&& le32_cmpz(phead->group)
|
||||
&& !(phead->control & SE_GROUP_DEFAULTED));
|
||||
if (!missing
|
||||
&& (phead->control & SE_SELF_RELATIVE)
|
||||
|
|
|
@ -1239,7 +1239,7 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name,
|
|||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
if (!a->length)
|
||||
if (le32_cmpz(a->length))
|
||||
break;
|
||||
/* If this is an enumeration return this attribute. */
|
||||
if (le32_eq(type, AT_UNUSED))
|
||||
|
@ -2849,7 +2849,7 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m)
|
|||
err = 0;
|
||||
|
||||
while ((char*)sds_header < (char*)sds + sds_size) {
|
||||
if (!sds_header->length)
|
||||
if (le32_cmpz(sds_header->length))
|
||||
break;
|
||||
/* SDH index entry */
|
||||
idx_entry_sdh->data_offset = const_cpu_to_le16(0x18);
|
||||
|
|
|
@ -764,7 +764,7 @@ static int new_attribute(ntfs_attr_search_ctx *ctx,
|
|||
ATTR_TYPES prev_atype,
|
||||
char *prev_name)
|
||||
{
|
||||
if (!prev_atype && !prev_name)
|
||||
if (le32_cmpz(prev_atype) && !prev_name)
|
||||
return 1;
|
||||
|
||||
if (!ctx->attr->non_resident)
|
||||
|
|
|
@ -1959,13 +1959,13 @@ static int ntfs_fuse_create(fuse_req_t req, fuse_ino_t parent, const char *name,
|
|||
*/
|
||||
if (ctx->security.mapping[MAPUSERS]) {
|
||||
#if POSIXACLS
|
||||
if (!securid
|
||||
if (le32_cmpz(securid)
|
||||
&& ntfs_set_inherited_posix(&security, ni,
|
||||
security.uid, gid,
|
||||
dir_ni, perm) < 0)
|
||||
set_fuse_error(&res);
|
||||
#else
|
||||
if (!securid
|
||||
if (le32_cmpz(securid)
|
||||
&& ntfs_set_owner_mode(&security, ni,
|
||||
security.uid, gid,
|
||||
perm & ~security.umask) < 0)
|
||||
|
|
|
@ -1753,13 +1753,13 @@ static int ntfs_fuse_create(const char *org_path, mode_t typemode, dev_t dev,
|
|||
*/
|
||||
if (ctx->security.mapping[MAPUSERS]) {
|
||||
#if POSIXACLS
|
||||
if (!securid
|
||||
if (le32_cmpz(securid)
|
||||
&& ntfs_set_inherited_posix(&security, ni,
|
||||
security.uid, gid,
|
||||
dir_ni, perm) < 0)
|
||||
set_fuse_error(&res);
|
||||
#else
|
||||
if (!securid
|
||||
if (le32_cmpz(securid)
|
||||
&& ntfs_set_owner_mode(&security, ni,
|
||||
security.uid, gid,
|
||||
perm & ~security.umask) < 0)
|
||||
|
|
Loading…
Reference in New Issue