[6278] in Athena Bugs

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

session_gate

daemon@ATHENA.MIT.EDU (John Carr)
Wed Oct 24 16:04:01 1990

To: bugs@ATHENA.MIT.EDU
Date: Wed, 24 Oct 90 16:03:48 EDT
From: John Carr <jfc@ATHENA.MIT.EDU>


Process IDs can be greater than 99999.

*** session_gate.c.71R	Wed Aug 09 01:33:24 1989
--- session_gate.c	Wed Oct 24 15:58:19 1990
***************
*** 48,56 ****
  
      /*  Figure out the filename  */
  
!     strcpy(filename, PID_FILE_TEMPLATE);
!     itoa(getuid(), buf);
!     strcat(filename, buf);
  
      /*  Put pid in file for the first time  */
  
--- 48,54 ----
  
      /*  Figure out the filename  */
  
!     sprintf(filename, "%s%d", PID_FILE_TEMPLATE, getuid());
  
      /*  Put pid in file for the first time  */
  
***************
*** 72,99 ****
        }
  }
  
- 
- static powers[] = {10000,1000,100,10,1};
- 
- int itoa(x, buf)
- int x;
- char *buf;
- {
-     int i;
-     int pos=0;
-     int digit;
- 
-     for (i = 0; i < 5; i++)
-       {
- 	  digit = (x/powers[i]) % 10;
- 	  if ((pos > 0) || (digit != 0) || (i == 4))
- 	    buf[pos++] = '0' + (char) digit;
-       }
-     buf[pos] = '\0';
-     return pos;
- }
- 
- 
  void cleanup( )
  {
      unlink(filename);
--- 70,75 ----
***************
*** 188,194 ****
  {
      char buf[10];
  
!     itoa(pid, buf);
!     strcat(buf, "\n");
      write(fd, buf, strlen(buf));
  }
--- 164,169 ----
  {
      char buf[10];
  
!     sprintf(buf, "%d\n", pid);
      write(fd, buf, strlen(buf));
  }

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