xref: /csrg-svn/usr.bin/uucp/libuu/anyread.c (revision 48652)
1*48652Sbostic /*-
2*48652Sbostic  * Copyright (c) 1985 The Regents of the University of California.
3*48652Sbostic  * All rights reserved.
4*48652Sbostic  *
5*48652Sbostic  * %sccs.include.proprietary.c%
6*48652Sbostic  */
7*48652Sbostic 
813635Ssam #ifndef lint
9*48652Sbostic static char sccsid[] = "@(#)anyread.c	5.5 (Berkeley) 04/24/91";
10*48652Sbostic #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  */
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