* callback.c (cb_is_stdin): Add.
	* syscall.c (cb_syscall): Test for stdin, not just fd 0.
2007-10-11  Jesper Nilsson  <jesper.nilsson@axis.com>
	* callback.h (cb_is_stdin): Add prototype.
+2007-10-11  Jesper Nilsson  <jesper.nilsson@axis.com>
+
+       * callback.h (cb_is_stdin): Add prototype.
+
 2007-08-23  Joel Brobecker  <brobecker@adacore.com>
 
        Switch the license of all .h files to GPLv3.
 
 /* Translate a value to target endian.  */
 void cb_store_target_endian PARAMS ((host_callback *, char *, int, long));
 
+/* Test if the fd is stdin. */
+int cb_is_stdin PARAMS ((host_callback *, int));
+
 /* Perform a system call.  */
 CB_RC cb_syscall PARAMS ((host_callback *, CB_SYSCALL *));
 
 
+2007-10-11  Jesper Nilsson  <jesper.nilsson@axis.com>
+
+       * callback.c (cb_is_stdin): Add.
+       * syscall.c (cb_syscall): Test for stdin, not just fd 0.
+
 2007-08-10  Nick Clifton  <nickc@redhat.com>
 
        * sim-memopt.c (memory_options): Mention that the
 
   p->evprintf_filtered (p, fmt, ap);
   va_end (ap);
 }
+
+int
+cb_is_stdin (host_callback *cb, int fd)
+{
+  return fdbad (cb, fd) ? 0 : fdmap (cb, fd) == 0;
+}
+
 
 
        while (count > 0)
          {
-           if (fd == 0)
+           if (cb_is_stdin (cb, fd))
              result = (int) (*cb->read_stdin) (cb, buf,
                                                (count < FILE_XFR_SIZE
                                                 ? count : FILE_XFR_SIZE));