summaryrefslogtreecommitdiff
path: root/userland/minibox/utilities/sh/sh.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-12-12 16:03:08 +0100
committerAnton Kling <anton@kling.gg>2024-12-12 16:03:08 +0100
commitb033314bf1901d436dc71d41d5e1f37dda47e511 (patch)
tree120bd137888a7f96904a47af7d20422608ffe225 /userland/minibox/utilities/sh/sh.c
parentdcbcdbdc5bcfb86eca05fb655e3bf009d89e39e0 (diff)
formatting: Use clang-format on all projects
This commit also add braces to all `if` statements.
Diffstat (limited to 'userland/minibox/utilities/sh/sh.c')
-rw-r--r--userland/minibox/utilities/sh/sh.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/userland/minibox/utilities/sh/sh.c b/userland/minibox/utilities/sh/sh.c
index b00b440..3643d99 100644
--- a/userland/minibox/utilities/sh/sh.c
+++ b/userland/minibox/utilities/sh/sh.c
@@ -68,8 +68,9 @@ int execute_binary(struct AST *ast, int input_fd) {
}
if (ast->pipe_rhs) {
- if (out >= 0)
+ if (out >= 0) {
close(out);
+ }
return execute_command(ast->pipe_rhs, slave_input);
}
@@ -135,14 +136,16 @@ void execute_ast(struct AST *ast) {
} else if (AST_CONDITIONAL_AND == ast->type) {
if (0 != rc) {
ast = ast->next;
- if (!ast)
+ if (!ast) {
break;
+ }
}
} else if (AST_CONDITIONAL_NOT == ast->type) {
if (0 == rc) {
ast = ast->next;
- if (!ast)
+ if (!ast) {
break;
+ }
}
}
ast = ast->next;