blob: 53f74ec81c3e4e563aae6a68cdb8f666c72af9a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/* mode.c
Get the Unix file mode of a file. */
#include "uucp.h"
#include "uudefs.h"
#include "sysdep.h"
#include "system.h"
#include <errno.h>
unsigned int
ixsysdep_file_mode (zfile)
const char *zfile;
{
struct stat s;
if (stat ((char *) zfile, &s) != 0)
{
ulog (LOG_ERROR, "stat (%s): %s", zfile, strerror (errno));
return 0;
}
#if S_IRWXU != 0700
#error Files modes need to be translated
#endif
/* We can't return 0, since that indicate an error. */
if ((s.st_mode & 0777) == 0)
return 0400;
return s.st_mode & 0777;
}
|