修訂 | bf777b3966985cdb27184df90d175cb5a7a8fedc (tree) |
---|---|
時間 | 2016-01-09 15:30:42 |
作者 | Yoshinori Sato <ysato@user...> |
Commiter | Yoshinori Sato |
use ptsname.
@@ -7,10 +7,11 @@ | ||
7 | 7 | #include <fcntl.h> |
8 | 8 | #include <sys/time.h> |
9 | 9 | #include <string.h> |
10 | -#define _XOPEN_SOURCE | |
10 | +#define __USE_XOPEN | |
11 | 11 | #include <stdlib.h> |
12 | 12 | #include <sys/socket.h> |
13 | 13 | #include <netinet/in.h> |
14 | +#include <stdint.h> | |
14 | 15 | |
15 | 16 | #include "sim-main.h" |
16 | 17 | #undef CSIZE |
@@ -977,7 +978,8 @@ static char *openpty(int ch) | ||
977 | 978 | if(fd >= 0) { |
978 | 979 | grantpt(fd); |
979 | 980 | unlockpt(fd); |
980 | - ptsname_r(fd, ptyname, sizeof(ptyname)); | |
981 | + strncpy(ptyname, ptsname(fd), sizeof(ptyname)); | |
982 | + ptyname[sizeof(ptyname) - 1] = '\0'; | |
981 | 983 | } else { |
982 | 984 | for(c1='a';c1<='z';c1++) |
983 | 985 | for(c2=0;c2<sizeof(nm)-1;c2++) { |