aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/degesch.c b/degesch.c
index de04bea..4129e07 100644
--- a/degesch.c
+++ b/degesch.c
@@ -10871,7 +10871,7 @@ launch_input_editor (struct app_context *ctx)
}
static void
-process_edited_input (struct app_context *ctx)
+input_editor_process (struct app_context *ctx)
{
struct str input;
str_init (&input);
@@ -10889,13 +10889,18 @@ process_edited_input (struct app_context *ctx)
log_global_error (ctx, "#s: #s", "Input editing failed",
"could not re-insert the modified text");
+ str_free (&input);
+}
+
+static void
+input_editor_cleanup (struct app_context *ctx)
+{
if (unlink (ctx->editor_filename))
log_global_error (ctx, "Could not unlink `#s': #l",
ctx->editor_filename, strerror (errno));
free (ctx->editor_filename);
ctx->editor_filename = NULL;
- str_free (&input);
ctx->running_editor = false;
}
@@ -11628,7 +11633,7 @@ try_reap_child (struct app_context *ctx)
ctx->running_backlog_helper = false;
else if (!ctx->running_editor)
{
- print_debug ("an unknown child has died");
+ log_global_debug (ctx, "An unknown child has died");
return true;
}
@@ -11642,7 +11647,10 @@ try_reap_child (struct app_context *ctx)
log_global_error (ctx,
"Child returned status #d", WEXITSTATUS (status));
else if (ctx->running_editor)
- process_edited_input (ctx);
+ input_editor_process (ctx);
+
+ if (ctx->running_editor)
+ input_editor_cleanup (ctx);
return true;
}