=================================================================== RCS file: /home/cvs/OpenXM_contrib2/fep/fep_main.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -p -r1.5 -r1.6 --- OpenXM_contrib2/fep/fep_main.c 2005/01/18 14:20:19 1.5 +++ OpenXM_contrib2/fep/fep_main.c 2009/02/24 07:30:15 1.6 @@ -2,7 +2,7 @@ #ifndef lint static char rcsid[]= -"$Id: fep_main.c,v 1.5 2005/01/18 14:20:19 ohara Exp $ (SRA)"; +"$Id: fep_main.c,v 1.6 2009/02/24 07:30:15 noro Exp $ (SRA)"; #endif /* lint */ #include @@ -866,16 +866,26 @@ get_pty_master() master = 1; return; } -#ifdef __CYGWIN32__ +#if defined(__CYGWIN32__) || defined(__linux__) sprintf (master_tty, "/dev/ptmx"); master = open (master_tty, O_RDWR); if (master >= 0) { +#if defined(__linux__) + char name[BUFSIZ]; + grantpt(master); + unlockpt(master); + if ( !ptsname_r(master,name,sizeof(name)) ) { + strcpy(slave_tty, name); + goto FOUND; + } +#else char *name; name = (char *)ptsname(master); if ( name != 0 ) { strcpy(slave_tty, name); goto FOUND; } +#endif } #else for (c = 'p'; c <= 's'; c++) {