diff --git a/libc/stdio/lib_freopen.c b/libc/stdio/lib_freopen.c
index 830ea9a78f51a97dc66005b46473ff66cdbbfb48..0fffc1bd9618d4d7e53703ea285d12e782f4ff13 100644
--- a/libc/stdio/lib_freopen.c
+++ b/libc/stdio/lib_freopen.c
@@ -113,7 +113,7 @@ FAR FILE *freopen(FAR const char *path, FAR const char *mode,
       /* Convert the mode string into standard file open mode flags. */
 
       oflags = lib_mode2oflags(mode);
-      if (oflags == 0)
+      if (oflags < 0)
         {
           return NULL;
         }