diff options
author | John Keeping <john@keeping.me.uk> | 2013-05-19 00:21:36 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-05-22 19:53:06 (JST) |
commit | 1e9f1ee64e5f8f75a361260a2165996bc137b961 (patch) | |
tree | e8ce7148ac4ad40dc703b0c48ba7e3aa67843357 | |
parent | 1fec7cd6f817e52a6e55458d584a7a5092ba6aed (diff) | |
download | cgit-1e9f1ee64e5f8f75a361260a2165996bc137b961.zip cgit-1e9f1ee64e5f8f75a361260a2165996bc137b961.tar.gz |
shared.c: use die_errno() where appropriate
This replaces some code that is re-implementing die_errno by just
calling the function.
Signed-off-by: John Keeping <john@keeping.me.uk>
-rw-r--r-- | shared.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -15,21 +15,21 @@ struct cgit_context ctx; | |||
15 | int chk_zero(int result, char *msg) | 15 | int chk_zero(int result, char *msg) |
16 | { | 16 | { |
17 | if (result != 0) | 17 | if (result != 0) |
18 | die("%s: %s", msg, strerror(errno)); | 18 | die_errno("%s", msg); |
19 | return result; | 19 | return result; |
20 | } | 20 | } |
21 | 21 | ||
22 | int chk_positive(int result, char *msg) | 22 | int chk_positive(int result, char *msg) |
23 | { | 23 | { |
24 | if (result <= 0) | 24 | if (result <= 0) |
25 | die("%s: %s", msg, strerror(errno)); | 25 | die_errno("%s", msg); |
26 | return result; | 26 | return result; |
27 | } | 27 | } |
28 | 28 | ||
29 | int chk_non_negative(int result, char *msg) | 29 | int chk_non_negative(int result, char *msg) |
30 | { | 30 | { |
31 | if (result < 0) | 31 | if (result < 0) |
32 | die("%s: %s", msg, strerror(errno)); | 32 | die_errno("%s", msg); |
33 | return result; | 33 | return result; |
34 | } | 34 | } |
35 | 35 | ||
@@ -468,8 +468,7 @@ int cgit_open_filter(struct cgit_filter *filter) | |||
468 | chk_non_negative(dup2(filter->pipe_fh[0], STDIN_FILENO), | 468 | chk_non_negative(dup2(filter->pipe_fh[0], STDIN_FILENO), |
469 | "Unable to use pipe as STDIN"); | 469 | "Unable to use pipe as STDIN"); |
470 | execvp(filter->cmd, filter->argv); | 470 | execvp(filter->cmd, filter->argv); |
471 | die("Unable to exec subprocess %s: %s (%d)", filter->cmd, | 471 | die_errno("Unable to exec subprocess %s", filter->cmd); |
472 | strerror(errno), errno); | ||
473 | } | 472 | } |
474 | close(filter->pipe_fh[0]); | 473 | close(filter->pipe_fh[0]); |
475 | chk_non_negative(dup2(filter->pipe_fh[1], STDOUT_FILENO), | 474 | chk_non_negative(dup2(filter->pipe_fh[1], STDOUT_FILENO), |