]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Remove unused function
authorStéphane Graber <stgraber@stgraber.org>
Wed, 5 Jun 2024 22:40:15 +0000 (18:40 -0400)
committerStéphane Graber <stgraber@stgraber.org>
Tue, 9 Jul 2024 05:19:45 +0000 (01:19 -0400)
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
src/lxc/utils.c
src/lxc/utils.h

index 0b14c05ad80cb69b1a11c199b815f34e8d59b27e..60f2b700036777ab916d2a31b888f0f634610eff 100644 (file)
@@ -974,101 +974,6 @@ char *on_path(const char *cmd, const char *rootfs)
        return NULL;
 }
 
-/* historically lxc-init has been under /usr/lib/lxc and under
- * /usr/lib/$ARCH/lxc.  It now lives as $prefix/sbin/init.lxc.
- */
-char *choose_init(const char *rootfs)
-{
-       char *retv = NULL;
-       const char *empty = "",
-                  *tmp;
-       int ret, env_set = 0;
-
-       if (!getenv("PATH")) {
-               if (setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 0))
-                       SYSERROR("Failed to setenv");
-
-               env_set = 1;
-       }
-
-       retv = on_path("init.lxc", rootfs);
-
-       if (env_set)
-               if (unsetenv("PATH"))
-                       SYSERROR("Failed to unsetenv");
-
-       if (retv)
-               return retv;
-
-       retv = malloc(PATH_MAX);
-       if (!retv)
-               return NULL;
-
-       if (rootfs)
-               tmp = rootfs;
-       else
-               tmp = empty;
-
-       ret = strnprintf(retv, PATH_MAX, "%s/%s/%s", tmp, SBINDIR, "/init.lxc");
-       if (ret < 0) {
-               ERROR("The name of path is too long");
-               goto out1;
-       }
-
-       if (access(retv, X_OK) == 0)
-               return retv;
-
-       ret = strnprintf(retv, PATH_MAX, "%s/%s/%s", tmp, LXCINITDIR, "/lxc/lxc-init");
-       if (ret < 0) {
-               ERROR("The name of path is too long");
-               goto out1;
-       }
-
-       if (access(retv, X_OK) == 0)
-               return retv;
-
-       ret = strnprintf(retv, PATH_MAX, "%s/usr/lib/lxc/lxc-init", tmp);
-       if (ret < 0) {
-               ERROR("The name of path is too long");
-               goto out1;
-       }
-
-       if (access(retv, X_OK) == 0)
-               return retv;
-
-       ret = strnprintf(retv, PATH_MAX, "%s/sbin/lxc-init", tmp);
-       if (ret < 0) {
-               ERROR("The name of path is too long");
-               goto out1;
-       }
-
-       if (access(retv, X_OK) == 0)
-               return retv;
-
-       /*
-        * Last resort, look for the statically compiled init.lxc which we
-        * hopefully bind-mounted in.
-        * If we are called during container setup, and we get to this point,
-        * then the init.lxc.static from the host will need to be bind-mounted
-        * in.  So we return NULL here to indicate that.
-        */
-       if (rootfs)
-               goto out1;
-
-       ret = strnprintf(retv, PATH_MAX, "/init.lxc.static");
-       if (ret < 0) {
-               WARN("Nonsense - name /lxc.init.static too long");
-               goto out1;
-       }
-
-       if (access(retv, X_OK) == 0)
-               return retv;
-
-out1:
-       free(retv);
-       return NULL;
-}
-
 /*
  * Given the '-t' template option to lxc-create, figure out what to
  * do.  If the template is a full executable path, use that.  If it
index 956ea2a5e9e12c89374a0772815ba99007aa4a98..923ce8596c9fe14dcc7ae3cc326a9894af2b3b3b 100644 (file)
@@ -141,7 +141,6 @@ __hidden extern bool is_shared_mountpoint(const char *path);
 __hidden extern int detect_shared_rootfs(void);
 __hidden extern bool detect_ramfs_rootfs(void);
 __hidden extern char *on_path(const char *cmd, const char *rootfs);
-__hidden extern char *choose_init(const char *rootfs);
 __hidden extern bool switch_to_ns(pid_t pid, const char *ns);
 __hidden extern char *get_template_path(const char *t);
 __hidden extern int safe_mount(const char *src, const char *dest, const char *fstype,