libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

commit a6f586e77076f631197330370f1b8cc4204f5351
parent cfe67fbec09569d886a5cc3ea14361b05f874ebe
Author: Frederic Cambus <fred@statdns.com>
Date:   Wed, 31 Oct 2018 21:48:38 +0100

Separate assignement and test for the file descriptor

Diffstat:
Msrc/loadfile.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/loadfile.c b/src/loadfile.c @@ -30,7 +30,9 @@ ansilove_loadfile(struct ansilove_ctx *ctx, char *input) { } // load input file - if ((fd = open(input, O_RDONLY)) == -1) { + fd = open(input, O_RDONLY); + + if (fd == -1) { ctx->error = ANSILOVE_FILE_READ_ERROR; close(fd); return -1;