]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
file_utils: convert to strequal()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 13 Feb 2021 20:35:01 +0000 (21:35 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 13 Feb 2021 20:41:24 +0000 (21:41 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/file_utils.c

index 78fa85ed7029498bb5ebc91f7b5f3d0464942536..508e2a5bbf316c91fb4a8fab5322f1dff7e2de50 100644 (file)
@@ -363,22 +363,22 @@ FILE *fopen_cloexec(const char *path, const char *mode)
        int open_mode = 0, step = 0;
        FILE *f;
 
-       if (!strncmp(mode, "r+", 2)) {
+       if (strnequal(mode, "r+", 2)) {
                open_mode = O_RDWR;
                step = 2;
-       } else if (!strncmp(mode, "r", 1)) {
+       } else if (strnequal(mode, "r", 1)) {
                open_mode = O_RDONLY;
                step = 1;
-       } else if (!strncmp(mode, "w+", 2)) {
+       } else if (strnequal(mode, "w+", 2)) {
                open_mode = O_RDWR | O_TRUNC | O_CREAT;
                step = 2;
-       } else if (!strncmp(mode, "w", 1)) {
+       } else if (strnequal(mode, "w", 1)) {
                open_mode = O_WRONLY | O_TRUNC | O_CREAT;
                step = 1;
-       } else if (!strncmp(mode, "a+", 2)) {
+       } else if (strnequal(mode, "a+", 2)) {
                open_mode = O_RDWR | O_CREAT | O_APPEND;
                step = 2;
-       } else if (!strncmp(mode, "a", 1)) {
+       } else if (strnequal(mode, "a", 1)) {
                open_mode = O_WRONLY | O_CREAT | O_APPEND;
                step = 1;
        }