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