X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=client.c;h=90dc432b8829426cd9d4ce081e4f8e20a5fb194e;hp=6268c3de8892f921045e18f2f7e7560ada8c5083;hb=484e75562df55dca31ffcb9e5b05a490b4a3d3a1;hpb=4ac3134c050ba28b57e0ae9686eb1f6d83e6d586 diff --git a/client.c b/client.c index 6268c3de..90dc432b 100644 --- a/client.c +++ b/client.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2012 Andre Noll + * Copyright (C) 1997-2013 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -54,7 +54,7 @@ static void exec_pre_select(struct sched *s, struct task *t) sched_min_delay(s); } -static void exec_post_select(__a_unused struct sched *s, struct task *t) +static int exec_post_select(__a_unused struct sched *s, struct task *t) { struct exec_task *et = container_of(t, struct exec_task, task); struct btr_node *btrn = et->btrn; @@ -63,10 +63,8 @@ static void exec_post_select(__a_unused struct sched *s, struct task *t) int ret; ret = btr_node_status(btrn, 0, BTR_NT_LEAF); - if (ret <= 0) { - t->error = ret; - return; - } + if (ret <= 0) + return ret; sz = btr_next_buffer(btrn, &buf); if (sz <= 1) goto out; @@ -76,6 +74,7 @@ static void exec_post_select(__a_unused struct sched *s, struct task *t) et->result_buf[et->result_size - 1] = '\0'; out: btr_consume(btrn, sz); + return 0; } static int make_client_argv(const char *line) @@ -307,7 +306,7 @@ static void setatt_completer(struct i9e_completion_info *ci, free(orig); } sl[2 * num_atts] = NULL; - ret = i9e_extract_completions(ci->word, sl, &cr->matches); + i9e_extract_completions(ci->word, sl, &cr->matches); out: free(buf); free_argv(sl); @@ -531,23 +530,21 @@ __noreturn static void print_completions(void) #endif /* HAVE_READLINE */ -static void supervisor_post_select(struct sched *s, struct task *t) +static int supervisor_post_select(struct sched *s, __a_unused struct task *t) { - if (ct->task.error < 0) { - t->error = ct->task.error; - return; - } + if (ct->task.error < 0) + return ct->task.error; if (ct->status == CL_SENDING) { stdin_set_defaults(&sit); register_task(s, &sit.task); - t->error = -E_TASK_STARTED; - return; + return -E_TASK_STARTED; } if (ct->status == CL_RECEIVING) { stdout_set_defaults(&sot); register_task(s, &sot.task); - t->error = -E_TASK_STARTED; return; + return -E_TASK_STARTED; } + return 0; } static struct task svt = { @@ -612,7 +609,7 @@ int main(int argc, char *argv[]) case -E_BTR_EOF: ret = 0; break; - default: ret = ct->task.error; + default: ret = -E_SERVER_CMD_FAILURE; } } out: