xref: /original-bsd/usr.bin/uucp/libuu/anyread.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1985, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)anyread.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 #include "uucp.h"
13 #include <sys/stat.h>
14 
15 /*LINTLIBRARY*/
16 
17 /*
18  *	anyread		check if anybody can read
19  *	return SUCCESS ok: FAIL not ok
20  */
21 anyread(file)
22 char *file;
23 {
24 	struct stat s;
25 
26 	if (stat(subfile(file), &s) < 0)
27 		/* for security check a non existant file is readable */
28 		return SUCCESS;
29 	if (!(s.st_mode & ANYREAD))
30 		return FAIL;
31 	return SUCCESS;
32 }
33