[1260] in testers

home help back first fref pref prev next nref lref last post

7.2 session_gate: patches

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Fri Nov 30 10:28:01 1990

Date: Fri, 30 Nov 90 10:27:38 -0500
To: testers@MIT.EDU
From: Richard Basch <probe@MIT.EDU>


I quickly reviewed the code and found two errors (introduced in 7.2).
Here are the patches.

The first change caused the pid files to be written incorrectly.
The second change was an incorrect usage of "dup" vs. "dup2", and
neglecting to test that "f" was not 0.  (dup2 closes the old-fd if
necessary, and it also checks to see if the two arguments are the same).

-Richard


*** session_gate.c	Sun Nov 18 21:56:28 1990
--- /tmp/foo.c	Fri Nov 30 10:22:31 1990
***************
*** 85,91 ****
  }
  
  
! static powers[] = {100000, 10000,1000,100,10,1};
  
  int itoa(x, buf)
  int x;
--- 85,91 ----
  }
  
  
! static powers[] = {10000,1000,100,10,1};
  
  int itoa(x, buf)
  int x;
***************
*** 119,126 ****
      unlink(filename);
      f = open(".logout", O_RDONLY, 0);
      if (f >= 0) {
! 	close(0);
! 	dup(f, 0);
  	execl("/bin/csh", "logout", 0);
      }
      exit(0);
--- 119,125 ----
      unlink(filename);
      f = open(".logout", O_RDONLY, 0);
      if (f >= 0) {
! 	dup2(f, 0);
  	execl("/bin/csh", "logout", 0);
      }
      exit(0);

home help back first fref pref prev next nref lref last post