diff options
Diffstat (limited to 'gnu/libexec/uucp/libunix/mode.c')
| -rw-r--r-- | gnu/libexec/uucp/libunix/mode.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/libunix/mode.c b/gnu/libexec/uucp/libunix/mode.c new file mode 100644 index 000000000000..53f74ec81c3e --- /dev/null +++ b/gnu/libexec/uucp/libunix/mode.c @@ -0,0 +1,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; +} |
