[alt.sources.patches] getty 1.1 patch #1

paul@devon.lns.pa.us (Paul Sutcliffe Jr.) (02/09/90)

System: Enhanced SYSV Getty version 1.1
Patch #: 1
Priority: HIGH

Description:
	Corrected bug in handling of ECHO, ECHOE, and ECHOK
	in getlogname().

	The wtmp file was being clobbered on systems where an
	fopen with "w+" would truncate the file; now using "a".
	Also, getty will not create the wtmp file if it wasn't
	there already.

	Now opening the line with O_NDELAY set, to allow getty
	to do its hangup and line initialization even if
	carrier-detect is not present.

	The old patchlevel.h is renamed release.h, and a new
	patchlevel.h file is created.

Fix:	Save the shell archive below in your getty source directory,
	calling it "patch1.sh".  Then cd to that directory and say
	"sh patch1.sh".  This will create the following files:

		release.h	(your old patchlevel.h)
		patchlevel.h	(newly created)
		patch1

	To apply the patches, say "patch -p -N <patch1".
	If you don't have the patch program, apply them by hand,
	or get patch (version 2.0, latest patchlevel).

	After patching:
		Configure -d
		make depend
		make
		make install

	If patch indicates that patchlevel is the wrong version, you may need
	to apply one or more previous patches, or the patch may already
	have been applied.  See the patchlevel.h file to find out what has or
	has not been applied.  In any event, don't continue with the patch.


----- 8< ---------- 8< ---------- 8< ---------- 8< ---------- 8< -----
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	release.h
#	patchlevel.h
#	patch1
# This archive created: Thu Feb  8 17:57:23 1990
export PATH; PATH=/bin:$PATH
echo shar: renaming "'patchlevel.h'" to "'release.h'"
mv patchlevel.h release.h
echo shar: extracting "'patchlevel.h'" '(21 characters)'
sed 's/^X//' << \SHAR_EOF > 'patchlevel.h'
X#define PATCHLEVEL 0
SHAR_EOF
if test 21 -ne "`wc -c < 'patchlevel.h'`"
then
	echo shar: error transmitting "'patchlevel.h'" '(should have been 21 characters)'
fi
echo shar: extracting "'patch1'" '(8138 characters)'
if test -f 'patch1'
then
	echo shar: will not over-write existing file "'patch1'"
else
sed 's/^X//' << \SHAR_EOF > 'patch1'
XIndex: patchlevel.h
XPrereq: 0
X1c1
X< #define PATCHLEVEL 0
X---
X> #define PATCHLEVEL 1
X
XIndex: man/Makefile.SH
XPrereq: 1.1
X*** man/Makefile.SH.old	Thu Feb  8 17:37:38 1990
X--- man/Makefile.SH	Thu Feb  8 17:37:43 1990
X***************
X*** 1,9 ****
X  :
X! # $Id: Makefile.SH,v 1.1 90/01/16 16:01:02 paul Exp Locker: paul $
X  #
X  # Creates man/Makefile for getty distribution
X  #
X  # $Log:	Makefile.SH,v $
X  # Revision 1.1  90/01/16  16:01:02  paul
X  # Initial revision
X  # 
X--- 1,12 ----
X  :
X! # $Id: Makefile.SH,v 1.1.1.1 90/02/08 17:31:30 paul Exp Locker: paul $
X  #
X  # Creates man/Makefile for getty distribution
X  #
X  # $Log:	Makefile.SH,v $
X+ # Revision 1.1.1.1  90/02/08  17:31:30  paul
X+ # patch1: Look for release.h instead of patchlevel.h.
X+ # 
X  # Revision 1.1  90/01/16  16:01:02  paul
X  # Initial revision
X  # 
X***************
X*** 53,59 ****
X  
X  SRC=	..
X  TUNE=	$(SRC)/tune.h
X! PATLVL=	$(SRC)/patchlevel.h
X  
X  # what to make
X  all:	$man
X--- 56,62 ----
X  
X  SRC=	..
X  TUNE=	$(SRC)/tune.h
X! RELEASE=$(SRC)/release.h
X  
X  # what to make
X  all:	$man
X***************
X*** 71,77 ****
X  	$(ROFF) \$*.3 > \$*.man
X  
X  # dependencies
X! config.m4:	$(SRC)/config.sh $(TUNE) $(PATLVL)
X  	chmod +x makeconfig
X  	./makeconfig
X  
X--- 74,80 ----
X  	$(ROFF) \$*.3 > \$*.man
X  
X  # dependencies
X! config.m4:	$(SRC)/config.sh $(TUNE) $(RELEASE)
X  	chmod +x makeconfig
X  	./makeconfig
X  
X
XIndex: funcs.c
XPrereq: 1.1
X*** funcs.c.old	Thu Feb  8 17:34:10 1990
X--- funcs.c	Thu Feb  8 17:34:17 1990
X***************
X*** 1,5 ****
X  /*
X! **	$Id: funcs.c,v 1.1 90/01/16 16:14:28 paul Exp Locker: paul $
X  **
X  **	Miscellaneous routines.
X  */
X--- 1,5 ----
X  /*
X! **	$Id: funcs.c,v 1.1.1.1 90/02/08 09:36:17 paul Exp Locker: paul $
X  **
X  **	Miscellaneous routines.
X  */
X***************
X*** 21,26 ****
X--- 21,30 ----
X  
X  /*
X  **	$Log:	funcs.c,v $
X+ **	Revision 1.1.1.1  90/02/08  09:36:17  paul
X+ **	patch1: Corrected bug in handling of ECHO, ECHOE, and ECHOK
X+ **	patch1: in getlogname().
X+ **	
X  **	Revision 1.1  90/01/16  16:14:28  paul
X  **	Initial revision
X  **	
X***************
X*** 40,46 ****
X  
X  #if defined(RCSID) && !defined(lint)
X  static char *RcsId =
X! "@(#)$Id: funcs.c,v 1.1 90/01/16 16:14:28 paul Exp Locker: paul $";
X  #endif
X  
X  #ifndef	MAXBUF
X--- 44,50 ----
X  
X  #if defined(RCSID) && !defined(lint)
X  static char *RcsId =
X! "@(#)$Id: funcs.c,v 1.1.1.1 90/02/08 09:36:17 paul Exp Locker: paul $";
X  #endif
X  
X  #ifndef	MAXBUF
X***************
X*** 590,603 ****
X  			debug2(D_GETL, "returned (BADSPEED)\n");
X  			return(BADSPEED);
X  		}
X! 		if ((lflag & ECHO) == 0) {
X  			(void) putc(ch, stdout);
X  			(void) fflush(stdout);
X  		}
X  		if (ch == Erase) {
X  			if (count) {
X! 				if ((lflag & ECHOE) == 0) {
X! 					(void) fputs(" \b", stdout);
X  					(void) fflush(stdout);
X  				}
X  				--p;
X--- 594,607 ----
X  			debug2(D_GETL, "returned (BADSPEED)\n");
X  			return(BADSPEED);
X  		}
X! 		if (lflag & ECHO) {
X  			(void) putc(ch, stdout);
X  			(void) fflush(stdout);
X  		}
X  		if (ch == Erase) {
X  			if (count) {
X! 				if (lflag & ECHOE) {
X! 					(void) fputs("\b \b", stdout);
X  					(void) fflush(stdout);
X  				}
X  				--p;
X***************
X*** 604,610 ****
X  				--count;
X  			}
X  		} else if (ch == Kill) {
X! 			if ((lflag & ECHOK) == 0) {
X  				(void) fputs("\r\n", stdout);
X  				(void) fflush(stdout);
X  			}
X--- 608,614 ----
X  				--count;
X  			}
X  		} else if (ch == Kill) {
X! 			if (lflag & ECHOK) {
X  				(void) fputs("\r\n", stdout);
X  				(void) fflush(stdout);
X  			}
X
XIndex: main.c
XPrereq: 1.1
X*** main.c.old	Thu Feb  8 17:35:02 1990
X--- main.c	Thu Feb  8 17:35:34 1990
X***************
X*** 1,5 ****
X  /*
X! **	$Id: main.c,v 1.1 90/01/16 16:16:10 paul Exp Locker: paul $
X  **
X  **	Main body of program.
X  */
X--- 1,5 ----
X  /*
X! **	$Id: main.c,v 1.1.1.2 90/02/08 10:05:30 paul Exp Locker: paul $
X  **
X  **	Main body of program.
X  */
X***************
X*** 21,26 ****
X--- 21,37 ----
X  
X  /*
X  **	$Log:	main.c,v $
X+ **	Revision 1.1.1.2  90/02/08  10:05:30  paul
X+ **	patch1: Now opening the line with O_NDELAY set, to allow getty
X+ **	patch1: to do its hangup and line initialization even if
X+ **	patch1: carrier-detect is not present.
X+ **	
X+ **	Revision 1.1.1.1  90/02/08  09:56:07  paul
X+ **	patch1: The wtmp file was being clobbered on systems where an
X+ **	patch1: fopen with "w+" would truncate the file; now using "a".
X+ **	patch1: Also, getty will not create the wtmp file if it wasn't
X+ **	patch1: there already.
X+ **	
X  **	Revision 1.1  90/01/16  16:16:10  paul
X  **	Initial revision
X  **	
X***************
X*** 39,45 ****
X  
X  #if defined(RCSID) && !defined(lint)
X  static char *RcsId =
X! "@(#)$Id: main.c,v 1.1 90/01/16 16:16:10 paul Exp Locker: paul $";
X  #endif
X  
X  #if !defined(lint)
X--- 50,56 ----
X  
X  #if defined(RCSID) && !defined(lint)
X  static char *RcsId =
X! "@(#)$Id: main.c,v 1.1.1.2 90/02/08 10:05:30 paul Exp Locker: paul $";
X  #endif
X  
X  #if !defined(lint)
X***************
X*** 476,484 ****
X  
X  	debug2(D_RUN, "open stdin, stdout and stderr\n");
X  
X! 	/* get a new fd
X  	 */
X! 	if ((fd = open(devname, O_RDWR)) < 0) {	/* open the device */
X  		logerr("cannot open line");
X  		exit(FAIL);
X  	}
X--- 487,495 ----
X  
X  	debug2(D_RUN, "open stdin, stdout and stderr\n");
X  
X! 	/* open the device; don't wait around for carrier-detect
X  	 */
X! 	if ((fd = open(devname, O_RDWR | O_NDELAY)) < 0) {
X  		logerr("cannot open line");
X  		exit(FAIL);
X  	}
X***************
X*** 613,620 ****
X  			pututline(utmp);
X  
X  			/* write same record to end of wtmp
X  			 */
X! 			if ((fp = fopen(WTMP_FILE, "w+")) != (FILE *) NULL) {
X  				(void) fseek(fp, 0L, 2);
X  				(void) fwrite((char *)utmp,sizeof(*utmp),1,fp);
X  				(void) fclose(fp);
X--- 624,634 ----
X  			pututline(utmp);
X  
X  			/* write same record to end of wtmp
X+ 			 * if wtmp file exists
X  			 */
X! 			if (stat(WTMP_FILE, &st) && errno == ENOENT)
X! 				break;
X! 			if ((fp = fopen(WTMP_FILE, "a")) != (FILE *) NULL) {
X  				(void) fseek(fp, 0L, 2);
X  				(void) fwrite((char *)utmp,sizeof(*utmp),1,fp);
X  				(void) fclose(fp);
X
XIndex: man/makeconfig
XPrereq: 1.1
X*** man/makeconfig.old	Thu Feb  8 17:38:11 1990
X--- man/makeconfig	Thu Feb  8 17:38:16 1990
X***************
X*** 1,8 ****
X  :
X  #
X! # $Id: makeconfig,v 1.1 90/01/16 16:03:33 paul Exp Locker: paul $
X  #
X  # $Log:	makeconfig,v $
X  # Revision 1.1  90/01/16  16:03:33  paul
X  # Initial revision
X  # 
X--- 1,11 ----
X  :
X  #
X! # $Id: makeconfig,v 1.1.1.1 90/02/08 17:31:57 paul Exp Locker: paul $
X  #
X  # $Log:	makeconfig,v $
X+ # Revision 1.1.1.1  90/02/08  17:31:57  paul
X+ # patch1: Look for release.h instead of patchlevel.h.
X+ # 
X  # Revision 1.1  90/01/16  16:03:33  paul
X  # Initial revision
X  # 
X***************
X*** 30,36 ****
X  : where is the source
X  src=..
X  tune=$src/tune.h
X! patchlevel=$src/patchlevel.h
X  
X  : is package complete
X  if $test ! -f $tune; then
X--- 33,39 ----
X  : where is the source
X  src=..
X  tune=$src/tune.h
X! release=$src/release.h
X  
X  : is package complete
X  if $test ! -f $tune; then
X***************
X*** 44,50 ****
X  rmlist="$cppout $tuneout $rmlist"
X  $cppstdin -I$src -I. $cppminus <<EOS >$cppout
X  #include <$tune>
X! #include <$patchlevel>
X  console=CONSOLE
X  defaults=DEFAULTS
X  issue=ISSUE
X--- 47,53 ----
X  rmlist="$cppout $tuneout $rmlist"
X  $cppstdin -I$src -I. $cppminus <<EOS >$cppout
X  #include <$tune>
X! #include <$release>
X  console=CONSOLE
X  defaults=DEFAULTS
X  issue=ISSUE
X
XIndex: release.h
XPrereq: 1.1
X*** release.h.old	Thu Feb  8 17:37:07 1990
X--- release.h	Thu Feb  8 17:37:11 1990
X***************
X*** 1,16 ****
X  /*
X! **	$Id: patchlevel.h,v 1.1 90/01/16 16:17:12 paul Exp Locker: paul $
X  **
X! **	Getty release/patchlevel
X  */
X  
X  
X- #define	PATCHLEVEL	0		/* patchlevel */
X- 
X  /* these are used by the man pages, too
X   */
X! #define	RELEASE		"1.1"		/* release number */
X! #define	DATE		"16-Jan-90"	/* release date */
X  
X  
X! /* end of patchlevel.h */
X--- 1,14 ----
X  /*
X! **	$Id: release.h,v 1.1.1.1 90/02/08 17:24:43 paul Exp Locker: paul $
X  **
X! **	Getty release/date
X  */
X  
X  
X  /* these are used by the man pages, too
X   */
X! #define	RELEASE		"1.1.1"		/* release number */
X! #define	DATE		"08-Feb-90"	/* release date */
X  
X  
X! /* end of release.h */
SHAR_EOF
if test 8138 -ne "`wc -c < 'patch1'`"
then
	echo shar: error transmitting "'patch1'" '(should have been 8138 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0

INTERNET:  paul@devon.lns.pa.us        |      If life's a bitch, then
UUCP:      ...!rutgers!devon!paul      |      we must be her puppies.