From b2f4d849850052ad7915771397396c60c2e0ad9e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 11 Nov 2019 10:29:56 -0800 Subject: [PATCH] Added error checks --- bb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bb.c b/bb.c index 1b14a18..232dee1 100644 --- a/bb.c +++ b/bb.c @@ -665,12 +665,13 @@ void run_bbcmd(bb_t *bb, const char *cmd) } else if (matches_cmd(cmd, "help")) { // +help char filename[256] = "/tmp/bbhelp.XXXXXX"; int fd = mkostemp(filename, O_WRONLY); + if (fd == -1) err("Couldn't create temporary help file in /tmp/"); print_bindings(fd); close(fd); char script[512] = "less -rKX < "; strcat(script, filename); run_script(bb, script); - unlink(filename); + if (unlink(filename) == -1) err("Couldn't delete temporary help file: '%s'", filename); } else if (matches_cmd(cmd, "interleave:") || matches_cmd(cmd, "interleave")) { // +interleave set_bool(bb->interleave_dirs); sort_files(bb);