From 7a3fd562cb80da8881a5cebeab0641fcb7b2af30 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sat, 4 Oct 2025 13:55:04 +0200 Subject: Refer to the array indices by using enums --- FICS/utils.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'FICS/utils.c') diff --git a/FICS/utils.c b/FICS/utils.c index 4da2411..a48f4bd 100644 --- a/FICS/utils.c +++ b/FICS/utils.c @@ -905,10 +905,8 @@ truncate_file(char *file, int lines) if (trunc) { int fd; - errno = 0; - fd = open(file, g_open_flags[1], g_open_modes); - - if (fd < 0) { + if ((fd = open(file, g_open_flags[OPFL_WRITE], + g_open_modes)) < 0) { warn("%s: open", __func__); return 1; } else if ((fp = fdopen(fd, "w")) == NULL) { -- cgit v1.2.3