reopen should return NULL when oflags is less than 0, not equal to 0.

Because negative value is returned on failure of lib_mode2offlags which converts the mode string into file open mode flag.
This commit is contained in:
Gregory Nutt 2017-12-21 12:04:17 -06:00
parent d9f58fad39
commit 30dbae2dbe

View File

@ -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;
}