Path: utzoo!attcan!uunet!lll-winken!ames!ncar!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: script & lock Message-ID: <15399@mimsy.UUCP> Date: 11 Jan 89 05:12:03 GMT References: <17972@adm.BRL.MIL> <596@cf-cm.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 23 In article <596@cf-cm.UUCP> sme@computing-maths.cardiff.ac.uk (Simon Elliott) writes: >... A program run in script is attached to [a] pseudo terminal so >getlogin() returns a pointer to the null string entry from utmp. >Getlogin returns the NULL pointer only if it called from a process >which is NOT attached to any terminal (even a pseudo one). Not so. If I may quote from getlogin(): #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)getlogin.c 5.3 (Berkeley) 5/9/86"; #endif LIBC_SCCS and not lint ... if (ubuf.ut_name[0] == '\0') return (0); ... return (ubuf.ut_name); I believe *getlogin()==0 may be true under some broken Unixes. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris