struct kdbus_args args = {
};
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
if ((ret = kdbus_sanitize_attach_flags(cmd->attach_flags, &attach_flags)))
};
struct kdbus_meta_stack meta_stack;
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
/* registry must be held throughout lookup *and* collecting data */
owner = kdbus_name_get_owner(entry);
if (!owner ||
!kdbus_conn_policy_see_name(conn, current_cred(), name) ||
- (cmd->id != 0 && owner->conn->id != cmd->id)) {
+ (cmd->id && owner->conn->id != cmd->id)) {
/* pretend a name doesn't exist if you cannot see it */
ret = -ESRCH;
goto exit;
}
if (attach_flags & KDBUS_ATTACH_AUXGROUPS) /* not fake */
kdbus_meta_payload_collect_auxgroups_preallocated(meta_payload, &owner_conn->meta.meta, conn);
- if (attach_flags & KDBUS_ATTACH_NAMES && 0 > (ret = kdbus_meta_payload_collect_names(&meta_payload, owner_conn)))
- goto exit;
+ if (attach_flags & KDBUS_ATTACH_NAMES) {
+ if (0 > (ret = kdbus_meta_payload_collect_names(&meta_payload, owner_conn)))
+ goto exit;
+ ret = 0;
+ }
pay_size = kdbus_meta_payload_size(meta_payload);
kdbus_assert(!(pay_size % 8));
kdbus_kvec_set(&kvec[cnt++], kdbus_meta_payload_ptr(meta_payload), pay_size);
.argc = ARRAY_SIZE(argv),
};
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
item_attach_send = argv[0].item ? &argv[0].item->data64[0] : NULL;
!kdbus_conn_is_activator(conn))
return -EOPNOTSUPP;
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
cmd->dropped_msgs = 0;
!kdbus_conn_is_activator(conn))
return -EOPNOTSUPP;
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
ret = kdbus_pool_release_offset(&conn->pool, cmd->offset);
.argc = ARRAY_SIZE(argv),
};
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
ret = kdbus_policy_set(&ep->policy_db, args.items, args.items_size, 0, true, ep);
if (!kdbus_conn_is_ordinary(conn))
return -EOPNOTSUPP;
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
items_size = KDBUS_ITEMS_SIZE(cmd, items);
if (!kdbus_conn_is_ordinary(conn))
return -EOPNOTSUPP;
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
down_write(&conn->match_db.mdb_rwlock);
meta->common.tgid = get_pid(find_vpid(pids->pid));
meta->common.ppid = get_pid(find_vpid(pids->ppid));
- if ((pids->tid != 0 && !meta->common.pid) ||
- (pids->pid != 0 && !meta->common.tgid) ||
- (pids->ppid != 0 && !meta->common.ppid)) {
+ if ((pids->tid && !meta->common.pid) ||
+ (pids->pid && !meta->common.tgid) ||
+ (pids->ppid && !meta->common.ppid)) {
put_pid(meta->common.pid);
put_pid(meta->common.tgid);
put_pid(meta->common.ppid);
if (!kdbus_conn_is_ordinary(conn))
return -EOPNOTSUPP;
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
ret = kdbus_name_release(&conn->ep->bus->name_registry, conn,
KDBUS_LIST_QUEUED,
};
- ret = kdbus_args_parse(&args, argp, &cmd);
- if (ret != 0)
+ if ((ret = kdbus_args_parse(&args, argp, &cmd)))
return ret;
/* lock order: domain -> bus -> ep -> names -> conn */
return -EINVAL;
snprintf(prefix, sizeof(prefix), "%u-", uid);
- if (strncmp(name, prefix, strlen(prefix)) != 0)
+ if (strncmp(name, prefix, strlen(prefix)))
return -EINVAL;
return 0;