open.c

Peter Naulls peter at chocky.org
Tue Jan 29 14:35:29 PST 2002


Given the Linux man page, I think this is probably most appropriate.
In future, we might return different names.

Index: source/unix/open.c
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/unix/open.c,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 open.c
--- source/unix/open.c  2001/09/04 16:32:04     1.2.2.2
+++ source/unix/open.c  2002/01/29 22:32:42
@@ -46,6 +46,8 @@
 char *
 ttyname (int fd)
 {
+  static char name[10];
+
   if (BADF (fd))
     {
       (void) __set_errno (EBADF);
@@ -53,7 +55,7 @@
     }
 
   if (__u->fd[fd].device == DEV_TTY)
-    return "/dev/tty";
+    return strcpy(name, "/dev/tty");
 
   return NULL;
 }


-- 
------------------------------------------------------------------------
 Peter Naulls - peter at chocky.org
 RISC OS Projects Initiative  -  http://www.chocky.org/initiative/
 Java for RISC OS and ARM     -  http://www.chocky.org/java/
 Debian Linux on RiscPCs      -  http://www.chocky.org/debian/
------------------------------------------------------------------------



More information about the gcc mailing list