summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-04-10 21:54:31 +0200
committerKay Sievers <kay@vrfy.org>2012-04-10 22:43:05 +0200
commit49e942b2bc9fdedba79cd266a076ce9c9d91fc13 (patch)
treef628e16f183b9a40b3bfb34c842dbb3a54918509 /src/shared/util.c
parentcc0933371d5a19c1a102ce911cb01aae8909b949 (diff)
rename basic.la to shared.la and put selinux deps in shared-selinx.la
Only 34 of 74 tools need libselinux linked, and libselinux is a pain with its unconditional library constructor.
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 563853fad6..fef58d5f30 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1591,74 +1591,6 @@ char *file_in_same_dir(const char *path, const char *filename) {
return r;
}
-int safe_mkdir(const char *path, mode_t mode, uid_t uid, gid_t gid) {
- struct stat st;
-
- if (label_mkdir(path, mode) >= 0)
- if (chmod_and_chown(path, mode, uid, gid) < 0)
- return -errno;
-
- if (lstat(path, &st) < 0)
- return -errno;
-
- if ((st.st_mode & 0777) != mode ||
- st.st_uid != uid ||
- st.st_gid != gid ||
- !S_ISDIR(st.st_mode)) {
- errno = EEXIST;
- return -errno;
- }
-
- return 0;
-}
-
-
-int mkdir_parents(const char *path, mode_t mode) {
- const char *p, *e;
-
- assert(path);
-
- /* Creates every parent directory in the path except the last
- * component. */
-
- p = path + strspn(path, "/");
- for (;;) {
- int r;
- char *t;
-
- e = p + strcspn(p, "/");
- p = e + strspn(e, "/");
-
- /* Is this the last component? If so, then we're
- * done */
- if (*p == 0)
- return 0;
-
- if (!(t = strndup(path, e - path)))
- return -ENOMEM;
-
- r = label_mkdir(t, mode);
- free(t);
-
- if (r < 0 && errno != EEXIST)
- return -errno;
- }
-}
-
-int mkdir_p(const char *path, mode_t mode) {
- int r;
-
- /* Like mkdir -p */
-
- if ((r = mkdir_parents(path, mode)) < 0)
- return r;
-
- if (label_mkdir(path, mode) < 0 && errno != EEXIST)
- return -errno;
-
- return 0;
-}
-
int rmdir_parents(const char *path, const char *stop) {
size_t l;
int r = 0;