script & lock

Chris Torek chris at mimsy.UUCP
Wed Jan 11 15:12:03 AEST 1989


In article <596 at cf-cm.UUCP> sme at 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 at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list