[1094] in testers

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

xlogin dm changes

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Sat Nov 10 00:24:17 1990

To: testers@ATHENA.MIT.EDU
Date: Sat, 10 Nov 90 00:23:48 EST
From: John Carr <jfc@ATHENA.MIT.EDU>


Globlal variables accessed from signal handlers should be declared "volatile".
(pcc on the VAX won't accept this, but gcc can be used instead.  On our other
systems, the default compiler supports "volatile".)

#endif foo is illegal.

strcpy(x, ""); is the the same as *x = '\0'; and smaller and faster.

*** /afs/athena.mit.edu/astaff/project/xdm/src/dm/dm.c	Fri Nov  9 14:22:30 1990
--- dm.c	Sat Nov 10 00:18:46 1990
***************
*** 39,49 ****
  #define TRUE		(!FALSE)
  
  /* flags used by signal handlers */
! int alarm_running = NONEXISTANT;
! int xpid, x_running = NONEXISTANT;
! int consolepid, console_running = NONEXISTANT;
  int console_tty = 0, console_failed = FALSE;
! int loginpid, login_running = NONEXISTANT;
  int clflag;
  
  /* Programs */
--- 39,49 ----
  #define TRUE		(!FALSE)
  
  /* flags used by signal handlers */
! volatile int alarm_running = NONEXISTANT;
! volatile int xpid, x_running = NONEXISTANT;
! volatile int consolepid, console_running = NONEXISTANT;
  int console_tty = 0, console_failed = FALSE;
! volatile int loginpid, login_running = NONEXISTANT;
  int clflag;
  
  /* Programs */
***************
*** 51,57 ****
  char *login_prog = "/etc/athena/console-getty";
  #else
  char *login_prog = "/bin/login";
! #endif ultrix
  
  /* Files */
  char *utmpf =	"/etc/utmp";
--- 51,57 ----
  char *login_prog = "/etc/athena/console-getty";
  #else
  char *login_prog = "/bin/login";
! #endif
  
  /* Files */
  char *utmpf =	"/etc/utmp";
***************
*** 146,152 ****
  #ifdef TIOCCONS
      if (console)
        ioctl (0, TIOCCONS, 0);		/* Grab the console   */
! #endif TIOCCONS
      setpgrp(0, pgrp=getpid());		/* Reset the tty pgrp */
      ioctl (0, TIOCSPGRP, &pgrp);
  #endif
--- 146,152 ----
  #ifdef TIOCCONS
      if (console)
        ioctl (0, TIOCCONS, 0);		/* Grab the console   */
! #endif
      setpgrp(0, pgrp=getpid());		/* Reset the tty pgrp */
      ioctl (0, TIOCSPGRP, &pgrp);
  #endif
***************
*** 329,336 ****
      ioctl(0, TIOCSPGRP, &pgrp);
  #ifdef TIOCCONSx
      ioctl (0, TIOCCONS, 0);		/* Grab the console   */
- #endif TIOCCONS
  #endif
      ioctl(0, TIOCGETP, &mode);
      mode.sg_flags = mode.sg_flags & ~RAW | ECHO;
      ioctl(0, TIOCSETP, &mode);
--- 329,336 ----
      ioctl(0, TIOCSPGRP, &pgrp);
  #ifdef TIOCCONSx
      ioctl (0, TIOCCONS, 0);		/* Grab the console   */
  #endif
+ #endif
      ioctl(0, TIOCGETP, &mode);
      mode.sg_flags = mode.sg_flags & ~RAW | ECHO;
      ioctl(0, TIOCSETP, &mode);
***************
*** 386,392 ****
      }
  #ifdef TIOCCONS
      ioctl (console_tty, TIOCCONS, 0);		/* Grab the console   */
! #endif TIOCCONS
      line[5] = 't';
  
      gettimeofday(&now, 0);
--- 386,392 ----
      }
  #ifdef TIOCCONS
      ioctl (console_tty, TIOCCONS, 0);		/* Grab the console   */
! #endif
      line[5] = 't';
  
      gettimeofday(&now, 0);
***************
*** 399,405 ****
  	/* Set the console characteristics so we don't lose later */
  #ifdef TIOCCONS
  	ioctl (0, TIOCCONS, 0);		/* Grab the console   */
! #endif TIOCCONS
  	setpgrp(0, pgrp=getpid());		/* Reset the tty pgrp */
  	ioctl (0, TIOCSPGRP, &pgrp);
  #endif
--- 399,405 ----
  	/* Set the console characteristics so we don't lose later */
  #ifdef TIOCCONS
  	ioctl (0, TIOCCONS, 0);		/* Grab the console   */
! #endif
  	setpgrp(0, pgrp=getpid());		/* Reset the tty pgrp */
  	ioctl (0, TIOCSPGRP, &pgrp);
  #endif
***************
*** 482,488 ****
      found = 0;
      if ((file = open(utmpf, O_RDWR, 0)) >= 0) {
  	while (read(file, (char *) &utmp, sizeof(utmp)) > 0) {
! 	    if (!strncmp(utmp.ut_line, tty)) {
  		strncpy(login, utmp.ut_name, 8);
  		login[8] = 0;
  		utmp.ut_name[0] = 0;
--- 482,488 ----
      found = 0;
      if ((file = open(utmpf, O_RDWR, 0)) >= 0) {
  	while (read(file, (char *) &utmp, sizeof(utmp)) > 0) {
! 	    if (!strncmp(utmp.ut_line, tty, sizeof(utmp.ut_line))) {
  		strncpy(login, utmp.ut_name, 8);
  		login[8] = 0;
  		utmp.ut_name[0] = 0;
***************
*** 495,503 ****
      }
      if (found) {
  	if ((file = open(wtmpf, O_WRONLY|O_APPEND, 0644)) >= 0) {
! 	    strcpy(utmp.ut_line, tty);
! 	    strcpy(utmp.ut_name, "");
! 	    strcpy(utmp.ut_host, "");
  	    time(&utmp.ut_time);
  	    write(file, (char *) &utmp, sizeof(utmp));
  	    close(file);
--- 495,503 ----
      }
      if (found) {
  	if ((file = open(wtmpf, O_WRONLY|O_APPEND, 0644)) >= 0) {
! 	    strncpy(utmp.ut_line, tty, sizeof(utmp.ut_line));
! 	    utmp.ut_name[0] = '\0';
! 	    utmp.ut_host[0] = '\0';
  	    time(&utmp.ut_time);
  	    write(file, (char *) &utmp, sizeof(utmp));
  	    close(file);

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