Skip to content

Commit

Permalink
unix_msg: Return errno from find_send_queue
Browse files Browse the repository at this point in the history
Signed-off-by: : Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
slowfranklin authored and jrasamba committed Sep 12, 2016
1 parent 3f45fce commit e0de912
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions source3/lib/unix_msg/unix_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,17 +433,19 @@ static void unix_dgram_send_queue_free(struct unix_dgram_send_queue *q)
free(q);
}

static struct unix_dgram_send_queue *find_send_queue(
struct unix_dgram_ctx *ctx, const struct sockaddr_un *dst)
static int find_send_queue(struct unix_dgram_ctx *ctx,
const struct sockaddr_un *dst,
struct unix_dgram_send_queue **ps)
{
struct unix_dgram_send_queue *s;

for (s = ctx->send_queues; s != NULL; s = s->next) {
if (strcmp(s->path, dst->sun_path) == 0) {
return s;
*ps = s;
return 0;
}
}
return NULL;
return ENOENT;
}

static int queue_msg(struct unix_dgram_send_queue *q,
Expand Down Expand Up @@ -604,8 +606,8 @@ static int unix_dgram_send(struct unix_dgram_ctx *ctx,
* To preserve message ordering, we have to queue a message when
* others are waiting in line already.
*/
q = find_send_queue(ctx, dst);
if (q != NULL) {
ret = find_send_queue(ctx, dst, &q);
if (ret == 0) {
return queue_msg(q, iov, iovlen, fds, num_fds);
}

Expand Down

0 comments on commit e0de912

Please sign in to comment.