print error if creating a socket() failed - teed - A multiplex relay tee(1) dae… | |
git clone git://bitreich.org/teed git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit b5674ba2b8612d190d7f61ed4816f56f7e1e9381 | |
parent 8d1db0f43e921b998a06dd61d1442220db29ee89 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 14 Aug 2023 14:22:26 +0200 | |
print error if creating a socket() failed | |
Signed-off-by: Christoph Lohmann <[email protected]> | |
Diffstat: | |
M teed.c | 4 +++- | |
1 file changed, 3 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/teed.c b/teed.c | |
@@ -173,8 +173,10 @@ main(int argc, char *argv[]) | |
on = 1; | |
for (i = 0; i < 2; i++) { | |
lfd = socket(AF_UNIX, SOCK_STREAM, 0); | |
- if (lfd < 0) | |
+ if (lfd < 0) { | |
+ perror("socket"); | |
goto stop_serving; | |
+ } | |
if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR, | |
&on, sizeof(on)) < 0) { | |
perror("setsockopt"); |