From 4f65ef98049889cb4e1856566b71cb4abc3b38a2 Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Mon, 4 Jul 2011 12:29:13 +0200 Subject: [PATCH] Factorize error messages --- src/fmail.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/fmail.c b/src/fmail.c index dcff8a4..f07b394 100644 --- a/src/fmail.c +++ b/src/fmail.c @@ -458,16 +458,12 @@ read_input_from_editor(void) int fd; FILE *f; - if ( asprintf(&filename, "%s/fmailXXXXXX", get_tmp_dir()) == -1 ) + if ( asprintf(&filename, "%s/fmailXXXXXX", get_tmp_dir()) == -1 + || (fd = mkstemp(filename)) == -1 ) err(EXIT_FAILURE, "cannot create temporary file"); - if ( (fd = mkstemp(filename)) == -1 ) - err(EXIT_FAILURE, "cannot create temporary file"); - - if ( asprintf(&command, "%s %s", get_editor(), filename) == -1 ) - err(EXIT_FAILURE, "cannot execute editor"); - - if ( system(command) == -1 ) + if ( asprintf(&command, "%s %s", get_editor(), filename) == -1 + || system(command) == -1 ) err(EXIT_FAILURE, "cannot execute editor"); if ( (f = fdopen(fd, "r")) == NULL )