Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!bellcore!faline!thumper!ulysses!andante!alice!debra From: debra@alice.UUCP (Paul De Bra) Newsgroups: comp.unix.wizards Subject: Re: script & lock Message-ID: <8616@alice.UUCP> Date: 27 Dec 88 22:19:50 GMT References: <17972@adm.BRL.MIL> Reply-To: debra@alice.UUCP () Organization: AT&T, Bell Labs Lines: 35 In article <17972@adm.BRL.MIL> drears@ardec.arpa (Dennis G. Rears (FSAC)) writes: > This happens on a VAX 8600 running ULTRIK but does not happen on >Goulds or Pyramids. I have a lock program I wrote several years >ago. When I run it on top of /usr/ucb/script I get a Bus Error when I >type in my password. Any idea why? Here is the program lock: >... > uname = getlogin(); /* What happens if the UTMP file is screwed? */ You might want to check on this. script may confuse getlogin. The 4.3 manual says: If getlogin is called within a process that is not attached to a terminal, or if there is no entry in /etc/utmp for the process's terminal, getlogin returns a NULL pointer (0). The manual further suggests: A reasonable procedure for determining the login name is to first call getlogin and if it fails, to call getpwuid(getuid()). > oldpass = getpass(""); script may or may not let you turn on/off the echo... after all the standard output of the program goes to script, not to the terminal... (I may be wrong on this one, my unix doesn't have script) One last comment: I would replace the strcmp calls by strncmp. You never know when you will get a bogus Unix version that forgets to 0-terminate a name from utmp or passwd when it is 8 characters long. Paul. -- ------------------------------------------------------ |debra@research.att.com | uunet!research!debra | ------------------------------------------------------