diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-07 22:47:57 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-07 22:49:53 +0100 |
commit | a5ac0d24b8fdf4fe06f56987b4b5992a2bda24bf (patch) | |
tree | c96d27b3a35b1126448e2a118f3d8030b94757dd /degesch.c | |
parent | cabab5f35143c9bbecd2024519d9572c55304a51 (diff) | |
download | xK-a5ac0d24b8fdf4fe06f56987b4b5992a2bda24bf.tar.gz xK-a5ac0d24b8fdf4fe06f56987b4b5992a2bda24bf.tar.xz xK-a5ac0d24b8fdf4fe06f56987b4b5992a2bda24bf.zip |
degesch: fix handling of input editor death
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -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; } |