|
|
1.1 root 1: #define _POSIX_SOURCE
2: #include <ctype.h>
3: #include <stddef.h>
4: #include <stdlib.h>
5: #include <stdio.h>
6: #include <string.h>
7: #include <sys/types.h>
8: #include <sys/stat.h>
9: #include <fcntl.h>
10: #include <unistd.h>
11: #include "lib.h"
12:
13: /*
14: * determine if we can recursively create the given pathname. not a
15: * generally useful function since it destroys the pathname.
16: */
17: static int
18: cancreate(char *path, int recurse)
19: {
20: char *slash;
21:
22: for (;;) {
23: slash = strrchr(path, '/');
24: if (! slash)
25: return 0; /* absolute pathnames only */
26: *slash = '\0';
27: if (!*path)
28: break;
29: if (access(path, W_OK) == 0)
30: return 1;
31: if (!recurse)
32: return 0;
33: if (access(path, F_OK) == 0)
34: return 0;
35: }
36: return access("/", W_OK) == 0;
37: }
38:
39: /*
40: * try the instructions of the package on the given fd against the
41: * permissions currently in the file system. return 1 if we think we
42: * ought to go ahead and try inspkg.
43: * the right place to put this guy would be in the tarf command;
44: * then eventually we could remove all tarfile support from dist
45: * proper when (if?) most systems have adequate tar commands.
46: */
47: int
48: tryperm(int fd)
49: {
50: return 1;
51: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.