[2053] in Athena Bugs

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

Re: (VS2) Version 6.1C: toehold

daemon@ATHENA.MIT.EDU (Ilhamuddin Ahmed)
Fri Apr 7 00:46:43 1989

Date: Fri, 7 Apr 89 00:45:40 EDT
From: Ilhamuddin Ahmed <ilham@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
Cc: jtkohl@ATHENA.MIT.EDU, ilham@ATHENA.MIT.EDU
Reply-To: ilham@ATHENA.MIT.EDU

John> Toehold never closes /etc/utmp.  Examine code in wait_alarm():
John>     if((file = open(utmpf, O_RDONLY, 0)) >= 0) {
John>         while(read(file, (char *) &utmp, sizeof(utmp)) > 0) {
John>             if(*utmp.ut_name) goto no_deactivate;
John>         }
John>         deactivate_workstation();
John>     }
John> 
John>     /* Here if someone's logged in or we can't open utmp */
John>   no_deactivate:
John>     /* If we don't have an X, restart toehold */
John>     if(!wpid) {
John>         die(0);
John>     }
John> 
John> What should have happened:
John> 
John> It should clean up, like all good programs.

This causes problems with xdm as toehold never exists in Xdm. The
following excerpt from ofiles shows this :

garfield [608] (toehold) % ofiles /  
/dev/hd0a:      /
user     process command        type    inode(s)
...
...
root     686     toehold        cf      4 4 4 1577 1577 1577 1577 1577 1577 1577
 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577
 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577
 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577 1577
 1577 1577 1577 1577 1577 1577 
...
...

garfield [609] (toehold) % /etc/ncheck -i 1577 /dev/rhd0a
/dev/rhd0a:
1577    /etc/utmp


This fix is simple and attached.

					- Ilhamuddin Ahmed
					  Project Athena `Watchmaker'

===============================================================================

*** /minos/source/4.3/etc.athena/toehold.c	Fri Mar 24 16:02:30 1989
--- toehold.c	Fri Apr  7 00:38:06 1989
***************
*** 350,357 ****
  
      if((file = open(utmpf, O_RDONLY, 0)) >= 0) {
  	while(read(file, (char *) &utmp, sizeof(utmp)) > 0) {
! 	    if(*utmp.ut_name) goto no_deactivate;
  	}
  	deactivate_workstation();
      }
  
--- 350,361 ----
  
      if((file = open(utmpf, O_RDONLY, 0)) >= 0) {
  	while(read(file, (char *) &utmp, sizeof(utmp)) > 0) {
! 	    if(*utmp.ut_name) {
! 		close(file);
! 		goto no_deactivate;
! 	    }
  	}
+ 	close(file);
  	deactivate_workstation();
      }
  

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