Skip to content

Fix syscall assertion when input file does not exist #999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 4 additions & 29 deletions jerry-libc/target/darwin/jerry-libc-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@

LIBC_UNREACHABLE_STUB_FOR (int raise (int sig_no __attr_unused___))

/**
* Exit program with ERR_SYSCALL if syscall_ret_val is negative
*/
#define LIBC_EXIT_ON_ERROR(syscall_ret_val) \
if ((syscall_ret_val) < 0) \
{ \
libc_fatal ("Syscall", __FILE__, __func__, __LINE__); \
}

static long int syscall_0 (long int syscall_no);
static long int syscall_1 (long int syscall_no, long int arg1);
static long int syscall_2 (long int syscall_no, long int arg1, long int arg2);
Expand All @@ -60,11 +51,7 @@ extern long int syscall_3_asm (long int syscall_no, long int arg1, long int arg2
static __attr_noinline___ long int
syscall_0 (long int syscall_no) /**< syscall number */
{
long int ret = syscall_0_asm (syscall_no);

LIBC_EXIT_ON_ERROR (ret);

return ret;
return syscall_0_asm (syscall_no);
} /* syscall_0 */

/**
Expand All @@ -76,11 +63,7 @@ static __attr_noinline___ long int
syscall_1 (long int syscall_no, /**< syscall number */
long int arg1) /**< argument */
{
long int ret = syscall_1_asm (syscall_no, arg1);

LIBC_EXIT_ON_ERROR (ret);

return ret;
return syscall_1_asm (syscall_no, arg1);
} /* syscall_1 */

/**
Expand All @@ -93,11 +76,7 @@ syscall_2 (long int syscall_no, /**< syscall number */
long int arg1, /**< first argument */
long int arg2) /**< second argument */
{
long int ret = syscall_2_asm (syscall_no, arg1, arg2);

LIBC_EXIT_ON_ERROR (ret);

return ret;
return syscall_2_asm (syscall_no, arg1, arg2);
} /* syscall_2 */

/**
Expand All @@ -111,11 +90,7 @@ syscall_3 (long int syscall_no, /**< syscall number */
long int arg2, /**< second argument */
long int arg3) /**< third argument */
{
long int ret = syscall_3_asm (syscall_no, arg1, arg2, arg3);

LIBC_EXIT_ON_ERROR (ret);

return ret;
return syscall_3_asm (syscall_no, arg1, arg2, arg3);
} /* syscall_3 */

/** Output of character. Writes the character c, cast to an unsigned char, to stdout. */
Expand Down
33 changes: 4 additions & 29 deletions jerry-libc/target/linux/jerry-libc-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@

LIBC_UNREACHABLE_STUB_FOR (int raise (int sig_no __attr_unused___))

/**
* Exit program with ERR_SYSCALL if syscall_ret_val is negative
*/
#define LIBC_EXIT_ON_ERROR(syscall_ret_val) \
if ((syscall_ret_val) < 0) \
{ \
libc_fatal ("Syscall", __FILE__, __func__, __LINE__); \
}

static long int syscall_0 (long int syscall_no);
static long int syscall_1 (long int syscall_no, long int arg1);
static long int syscall_2 (long int syscall_no, long int arg1, long int arg2);
Expand All @@ -60,11 +51,7 @@ extern long int syscall_3_asm (long int syscall_no, long int arg1, long int arg2
static __attr_noinline___ long int
syscall_0 (long int syscall_no) /**< syscall number */
{
long int ret = syscall_0_asm (syscall_no);

LIBC_EXIT_ON_ERROR (ret);

return ret;
return syscall_0_asm (syscall_no);
} /* syscall_0 */

/**
Expand All @@ -76,11 +63,7 @@ static __attr_noinline___ long int
syscall_1 (long int syscall_no, /**< syscall number */
long int arg1) /**< argument */
{
long int ret = syscall_1_asm (syscall_no, arg1);

LIBC_EXIT_ON_ERROR (ret);

return ret;
return syscall_1_asm (syscall_no, arg1);
} /* syscall_1 */

/**
Expand All @@ -93,11 +76,7 @@ syscall_2 (long int syscall_no, /**< syscall number */
long int arg1, /**< first argument */
long int arg2) /**< second argument */
{
long int ret = syscall_2_asm (syscall_no, arg1, arg2);

LIBC_EXIT_ON_ERROR (ret);

return ret;
return syscall_2_asm (syscall_no, arg1, arg2);
} /* syscall_2 */

/**
Expand All @@ -111,11 +90,7 @@ syscall_3 (long int syscall_no, /**< syscall number */
long int arg2, /**< second argument */
long int arg3) /**< third argument */
{
long int ret = syscall_3_asm (syscall_no, arg1, arg2, arg3);

LIBC_EXIT_ON_ERROR (ret);

return ret;
return syscall_3_asm (syscall_no, arg1, arg2, arg3);
} /* syscall_3 */

/** Output of character. Writes the character c, cast to an unsigned char, to stdout. */
Expand Down
2 changes: 1 addition & 1 deletion main-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ read_sources (const char *script_file_names[],

if (i < files_count)
{
JERRY_ERROR_MSG ("Failed to read script N%d\n", i + 1);
JERRY_ERROR_MSG ("Failed to open file: %s\n", script_file_names[i]);

return NULL;
}
Expand Down