* syscalls.c (_isatty): Fix return value.

This commit is contained in:
Corinna Vinschen 2010-08-27 11:55:36 +00:00
parent 1165007539
commit 95c929196b
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2010-08-27 Christophe Lyon <christophe.lyon@st.com>
* syscalls.c (_isatty): Fix return value.
2010-07-23 Naveen.H.S <naveenh1@kpitcummins.com> 2010-07-23 Naveen.H.S <naveenh1@kpitcummins.com>
Gina Verlekar <gina.verlekar@kpitcummins.com> Gina Verlekar <gina.verlekar@kpitcummins.com>

View File

@ -770,24 +770,30 @@ int
_isatty (int fd) _isatty (int fd)
{ {
struct fdent *pfd; struct fdent *pfd;
int tty;
pfd = findslot (fd); pfd = findslot (fd);
if (pfd == NULL) if (pfd == NULL)
{ {
errno = EBADF; errno = EBADF;
return -1; return 0;
} }
#ifdef ARM_RDI_MONITOR #ifdef ARM_RDI_MONITOR
return checkerror (do_AngelSWI (AngelSWI_Reason_IsTTY, &pfd->handle)); tty = do_AngelSWI (AngelSWI_Reason_IsTTY, &pfd->handle);
#else #else
register r0 asm("r0"); register r0 asm("r0");
r0 = pfd->handle; r0 = pfd->handle;
asm ("swi %a2" asm ("swi %a2"
: "=r" (r0) : "=r" (r0)
: "0"(r0), "i" (SWI_IsTTY)); : "0"(r0), "i" (SWI_IsTTY));
return checkerror (r0); tty = r0;
#endif #endif
if (tty == 1)
return 1;
errno = get_errno ();
return 0;
} }
int int