summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-16 05:47:04 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-16 05:47:04 +0200
commit6606089752df90f3eeb4924af109046f1c73554c (patch)
tree6d031dd2b3eec2f02f1a25aaa680c80ae95affd6 /src/nspawn/nspawn.c
parentdfb33a9737e62ab872d3937b7690b252d2892fe8 (diff)
path-util: unify code for detecting OS trees
This also makes sure we always detect an OS tree the same way, by checking for /etc/os-release.
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r--src/nspawn/nspawn.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index c257682451..416d4a69b4 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -918,20 +918,6 @@ static int drop_capabilities(void) {
return capability_bounding_set_drop(~arg_retain, false);
}
-static int is_os_tree(const char *path) {
- int r;
- char *p;
- /* We use /bin/sh as flag file if something is an OS */
-
- if (asprintf(&p, "%s/bin/sh", path) < 0)
- return -ENOMEM;
-
- r = access(p, F_OK);
- free(p);
-
- return r < 0 ? 0 : 1;
-}
-
static int process_pty(int master, pid_t pid, sigset_t *mask) {
char in_buffer[LINE_MAX], out_buffer[LINE_MAX];
@@ -1240,7 +1226,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (is_os_tree(arg_directory) <= 0) {
+ if (path_is_os_tree(arg_directory) <= 0) {
log_error("Directory %s doesn't look like an OS root directory. Refusing.", arg_directory);
goto finish;
}