]> git.pld-linux.org Git - packages/vtun.git/blob - vtun-getpt.patch
- rel. 4 due to fixed init file
[packages/vtun.git] / vtun-getpt.patch
1 --- vtun-2.5b1/configure.in     Thu Nov  8 10:04:44 2001
2 +++ vtun-2.5b1-p/configure.in   Thu Nov  8 13:04:35 2001
3 @@ -166,6 +166,8 @@
4  
5  AC_MSG_RESULT()
6  
7 +AC_CHECK_FUNCS([getpt grantpt unlockpt ptsname])
8 +
9  OS_REL=`uname -r | tr -d '[A-Za-z\-\_\.]'`
10  case $host_os in
11         *linux*)
12 --- vtun-2.5b1/generic/pty_dev.c        Mon Nov 20 08:57:33 2000
13 +++ vtun-2.5b1-p/generic/pty_dev.c      Thu Nov  8 10:11:44 2001
14 @@ -38,11 +38,27 @@
15   */  
16  int pty_open(char *sl_name)
17  {
18 +    int  mr_fd;
19 +#ifdef HAVE_GETPT && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_PTSNAME
20 +    char *ptyname;
21 +
22 +    if((mr_fd=getpt()) < 0)
23 +       return -1;
24 +    if(grantpt(mr_fd) != 0)
25 +       return -1;
26 +    if(unlockpt(mr_fd) != 0)
27 +       return -1;
28 +    if ((ptyname = (char*)ptsname(mr_fd)) == NULL)
29 +       return -1;
30 +    strcpy(sl_name, ptyname);
31 +    return mr_fd;
32 +
33 +#else
34 +
35      char ptyname[] = "/dev/ptyXY";
36      char ch[] = "pqrstuvwxyz";
37      char digit[] = "0123456789abcdefghijklmnopqrstuv";
38      int  l, m;
39 -    int  mr_fd;
40  
41      /* This algorithm should work for almost all standard Unices */    
42      for(l=0; ch[l]; l++ ) {
43 @@ -64,6 +80,7 @@
44             }
45         }
46         return -1;
47 +#endif
48  }
49  
50  /* Write frames to PTY device */
This page took 0.077712 seconds and 3 git commands to generate.