Some conditions which are fd value checking are wrong.
This patch fixes these conditions.
Change-Id: Ib0fb7c73fe8dda95cb8a90e170c3604422e4a68c
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
int fd = AppRequest(cmd, uid)
.SetPid(pid)
.SendSimply(AUL_SOCK_ASYNC);
- if (fd < 0 || sysconf(_SC_OPEN_MAX)) {
+ if (fd < 0 || fd >= sysconf(_SC_OPEN_MAX)) {
_E("Failed to send request. error(%d)", fd);
return fd;
}
.With(b)
.SetAppId(app_id)
.SendSimply(AUL_SOCK_ASYNC);
- if (fd <= 0 || fd > sysconf(_SC_OPEN_MAX)) {
+ if (fd <= 0 || fd >= sysconf(_SC_OPEN_MAX)) {
_E("Failed to send socket pair creation request. error(%d)", fd);
return fd;
}
int req_fd = AppRequest(RPC_PORT_CREATE, uid)
.With(b)
.SendSimply(AUL_SOCK_ASYNC);
- if (req_fd <= 0 || req_fd > sysconf(_SC_OPEN_MAX)) {
+ if (req_fd <= 0 || req_fd >= sysconf(_SC_OPEN_MAX)) {
_E("Failed to send socket creation request. error(%d)", req_fd);
return req_fd;
}
int ret;
int i;
- if (fd < 0 || fd > sysconf(_SC_OPEN_MAX)) {
+ if (fd < 0 || fd >= sysconf(_SC_OPEN_MAX)) {
_E("Invalid parameter");
return -1;
}
{
int ret;
- if (fd < 0 || fd > sysconf(_SC_OPEN_MAX)) {
+ if (fd < 0 || fd >= sysconf(_SC_OPEN_MAX)) {
_E("Invalid parameter");
return -EINVAL;
}
{
int ret;
- if (fd < 0 || fd > sysconf(_SC_OPEN_MAX))
+ if (fd < 0 || fd >= sysconf(_SC_OPEN_MAX))
return -EINVAL;
if (!pkt) {
.With(b)
.SetAppId(appid)
.Send();
- if (fd < 0 || fd > sysconf(_SC_OPEN_MAX)) {
+ if (fd < 0 || fd >= sysconf(_SC_OPEN_MAX)) {
_E("Failed to send launch request. appid(%s), result(%d)",
appid, fd);
if (reply_cb)
.With(b)
.SetAppId(appid)
.Send();
- if (fd < 0 || fd > sysconf(_SC_OPEN_MAX)) {
+ if (fd < 0 || fd >= sysconf(_SC_OPEN_MAX)) {
_E("Failed to send launch request. appid(%s), result(%d)",
appid.c_str(), fd);
return AUL_R_ECOMM;