xref: /csrg-svn/usr.bin/uucp/libuu/anyread.c (revision 62386)
148652Sbostic /*-
2*62386Sbostic  * Copyright (c) 1985, 1993
3*62386Sbostic  *	The Regents of the University of California.  All rights reserved.
448652Sbostic  *
548652Sbostic  * %sccs.include.proprietary.c%
648652Sbostic  */
748652Sbostic 
813635Ssam #ifndef lint
9*62386Sbostic static char sccsid[] = "@(#)anyread.c	8.1 (Berkeley) 06/06/93";
1048652Sbostic #endif /* not lint */
1113635Ssam 
1213635Ssam #include "uucp.h"
1313635Ssam #include <sys/stat.h>
1413635Ssam 
1523585Sbloom /*LINTLIBRARY*/
1623585Sbloom 
1717767Sralph /*
1813635Ssam  *	anyread		check if anybody can read
1917767Sralph  *	return SUCCESS ok: FAIL not ok
2013635Ssam  */
anyread(file)2113635Ssam anyread(file)
2213635Ssam char *file;
2313635Ssam {
2413635Ssam 	struct stat s;
2513635Ssam 
2617767Sralph 	if (stat(subfile(file), &s) < 0)
2713635Ssam 		/* for security check a non existant file is readable */
2817767Sralph 		return SUCCESS;
2913635Ssam 	if (!(s.st_mode & ANYREAD))
3017767Sralph 		return FAIL;
3117767Sralph 	return SUCCESS;
3213635Ssam }
33