From 3ae939e922279de5b1f3dccefd53317d36e7f75e Mon Sep 17 00:00:00 2001 From: justpretending Date: Tue, 31 Jan 2023 14:07:55 +0700 Subject: [PATCH] Remove some redundant conditions (fixes #3602) --- src/filehandling.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/filehandling.c b/src/filehandling.c index bda39a5e5..37126bbf6 100644 --- a/src/filehandling.c +++ b/src/filehandling.c @@ -80,7 +80,7 @@ bool hc_fopen (HCFILE *fp, const char *path, const char *mode) int fmode = S_IRUSR|S_IWUSR; - if (strncmp (mode, "a", 1) == 0 || strncmp (mode, "ab", 2) == 0) + if (strncmp (mode, "a", 1) == 0) { oflag = O_WRONLY | O_CREAT | O_APPEND; @@ -88,7 +88,7 @@ bool hc_fopen (HCFILE *fp, const char *path, const char *mode) if (strncmp (mode, "ab", 2) == 0) oflag |= O_BINARY; #endif } - else if (strncmp (mode, "r", 1) == 0 || strncmp (mode, "rb", 2) == 0) + else if (strncmp (mode, "r", 1) == 0) { oflag = O_RDONLY; fmode = -1; @@ -97,7 +97,7 @@ bool hc_fopen (HCFILE *fp, const char *path, const char *mode) if (strncmp (mode, "rb", 2) == 0) oflag |= O_BINARY; #endif } - else if (strncmp (mode, "w", 1) == 0 || strncmp (mode, "wb", 2) == 0) + else if (strncmp (mode, "w", 1) == 0) { oflag = O_WRONLY | O_CREAT | O_TRUNC;