2007-10-11 Jesper Nilsson <jesper.nilsson@axis.com>

* callback.c (cb_is_stdin, cb_is_stdout, cb_is_stderr): Add functions.
	* syscall.c (cb_syscall): Test for stdin/out/err, not just fd 0/1/2.

2007-10-11  Jesper Nilsson  <jesper.nilsson@axis.com>

	* callback.h (cb_is_stdin, cb_is_stdout, cb_is_stderr): Add prototypes.

2007-10-11  Jesper Nilsson  <jesper.nilsson@axis.com>

	* sim/cris/c/freopen2.c: Added testcase.
This commit is contained in:
Daniel Jacobowitz
2007-10-11 18:44:07 +00:00
parent b981d70963
commit eb639c5004
8 changed files with 64 additions and 10 deletions

View File

@@ -344,12 +344,12 @@ cb_syscall (cb, sc)
errcode = EINVAL;
goto FinishSyscall;
}
if (fd == 1)
if (cb_is_stdout(cb, fd))
{
result = (int) (*cb->write_stdout) (cb, buf, bytes_read);
(*cb->flush_stdout) (cb);
}
else if (fd == 2)
else if (cb_is_stderr(cb, fd))
{
result = (int) (*cb->write_stderr) (cb, buf, bytes_read);
(*cb->flush_stderr) (cb);