Fix fopen call on non-existing files. (#1442)

The main implementation of unix platform hangs, if the engine was
built with jerry-libc. Open system call returns with a negative
error code if cannot open the file, but fopen must return NULL
when error happens.

Fixes #1437.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó 2016-11-21 11:28:07 +01:00 committed by GitHub
parent 6ac0a39519
commit 4a0f78bc4b

View File

@ -178,7 +178,7 @@ fopen (const char *path, /**< file path */
long int ret = syscall_3 (SYSCALL_NO (open), (long int) path, flags, access);
return (void *) (uintptr_t) (ret);
return ((ret < 0) ? NULL : (void *) (uintptr_t) (ret));
} /* fopen */
/**