[comp.dcom.modems] PPP: Can't get PPP to work with sunOS 4.1.1

greg@cheers.Bungi.COM (Greg Onufer) (04/21/91)

mclay@zoyd.ae.utexas.edu (Robert McLay) writes:
>"ppp: tcsetpgrp ..." error.

Enclosed is an unofficial patch to correct the broken code in ppp.c.
The official keepers-of-the-source of ppp said this didn't work for
them, but it works for me and I've been using ppp with this patch on
a regular basis.  No guarantees express or implied :-)

Cheers!greg

diff -c ppp/ppp.c:1.1.1.1 ppp/ppp.c:1.2
*** ppp/ppp.c:1.1.1.1	Mon Mar 18 12:35:25 1991
--- ppp/ppp.c	Mon Mar 18 12:35:26 1991
***************
*** 112,120 ****
  struct sgttyb initsgttyb;	/* Initial TTY sgttyb */
  #endif
  int initfdflags;		/* Initial file descriptor flags */
! int pid;			/* Our pid */
  #ifdef sun
! int	pgrpid;			/* Process Group ID */
  #endif
  char user[80];			/* User name */
  
--- 112,120 ----
  struct sgttyb initsgttyb;	/* Initial TTY sgttyb */
  #endif
  int initfdflags;		/* Initial file descriptor flags */
! pid_t	pid;			/* Our pid */
  #ifdef sun
! pid_t	pgrpid;			/* Process Group ID */
  #endif
  char user[80];			/* User name */
  
***************
*** 296,305 ****
--- 296,315 ----
      /*
       * Initialize state.
       */
+ #if defined(sun) && defined(SUNOS) && SUNOS >= 41
+     if ((pgrpid = setsid()) < 0)
+ 	pgrpid = getpgrp(0);
+ #endif
      if ((fd = open(devname, O_RDWR /*| O_NDELAY*/)) < 0) {
  	perror(devname);
  	exit(1);
      }
+ #if defined(sun) && defined(SUNOS) && SUNOS >= 41
+     if (tcsetpgrp(fd, pgrpid) < 0) {
+   	perror("ppp: tcsetpgrp()");
+   	exit(1);
+     }
+ #endif
      if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
  	perror("ppp: socket");
  	exit(1);
***************
*** 402,415 ****
      if (debug)
  	printf("Pid %d.\n", pid);
  
! # if defined(sun) && defined(SUNOS) && SUNOS >= 41
!     if ((pgrpid = setsid()) < 0)
! 	pgrpid = getpgrp(0);
!     if (tcsetpgrp(fd, pgrpid) < 0) {
!   	perror("ppp: tcsetpgrp()");
!   	exit(1);
! 	}
! # else
      if (ioctl(fd, TIOCSPGRP, &pid) < 0) {
  	perror("ppp: ioctl(TIOCSPGRP)");
  	exit(1);
--- 412,418 ----
      if (debug)
  	printf("Pid %d.\n", pid);
  
! # if !defined(sun) || !defined(SUNOS) || SUNOS < 41
      if (ioctl(fd, TIOCSPGRP, &pid) < 0) {
  	perror("ppp: ioctl(TIOCSPGRP)");
  	exit(1);