use 'env' instead of 'clearenv'; the '-i' switch is SUSv3 and every implementation...
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 11 May 2004 18:49:25 +0000 (18:49 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 11 May 2004 18:49:25 +0000 (18:49 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1563 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/configure.ac
util-vserver/scripts/util-vserver-vars.pathsubst
util-vserver/scripts/vserver.start
util-vserver/src/Makefile-files
util-vserver/src/clearenv.c [deleted file]

index bf77562..5dda337 100644 (file)
@@ -24,7 +24,7 @@ dnl distribution terms that you use for the rest of that program.
 dnl  
 
 AC_PREREQ(2.57)
-AC_INIT(util-vserver, 0.29.213, enrico.scholz@informatik.tu-chemnitz.de)
+AC_INIT(util-vserver, 0.29.214, enrico.scholz@informatik.tu-chemnitz.de)
 AC_CONFIG_SRCDIR([src/capchroot.c])
 AC_CONFIG_HEADER([config.h])
 
@@ -56,6 +56,7 @@ AC_PATH_PROGS(MODPROBE, [modprobe], [/sbin/modprobe], [ $check_paths ])
 AC_PATH_PROGS(RMMOD,    [rmmod],    [/sbin/rmmod],    [ $check_paths ])
 AC_PATH_PROGS(NAMEIF,   [nameif],   [/sbin/nameif],   [ $check_paths ])
 AC_PATH_PROGS(IPTABLES, [iptables], [/sbin/iptables], [ $check_paths ])
+AC_PATH_PROGS(ENV,      [env],      [/usr/bin/env])
 AC_PATH_PROGS(SED,      [sed],      [sed])
 AC_PATH_PROGS(CMP,      [cmp],      [cmp])
 AC_PATH_PROGS(WGET,     [wget],     [wget])
index 0faa2fe..21a79f3 100644 (file)
@@ -34,7 +34,6 @@ _CHCONTEXT="$SBINDIR/chcontext"
 _CHCONTEXT_COMPAT="$PKGLIBDIR/chcontext-compat"
 _CHROOT_CAT="$PKGLIBDIR/chroot-cat"
 _CHROOT_RM="$PKGLIBDIR/chroot-rm"
-_CLEARENV="$PKGLIBDIR/clearenv"
 _EXEC_CD="$SBINDIR/exec-cd"
 _EXEC_ULIMIT="$PKGLIBDIR/exec-ulimit"
 _FAKE_RUNLEVEL="$PKGLIBDIR/fakerunlevel"
@@ -88,6 +87,7 @@ _VUNAME="$SBINDIR/vuname"
 _VUNIFY="$PKGLIBDIR/vunify"
 
 _AWK="@AWK@"
+_ENV="@ENV@"
 _GREP="@GREP@"
 _IP="@IP@"
 _IPTABLES="@IPTABLES@"
index f049d83..35ab903 100644 (file)
@@ -102,7 +102,7 @@ if $_VSERVER_INFO - FEATURE migrate; then
     $_VUNAME     --xid self --set -t context="$VSERVER_DIR" -- \
     $_VATTRIBUTE --set "${OPTS_VATTRIBUTE[@]}" -- \
     $_SAVE_CTXINFO "$VSERVER_DIR" \
-    $_CLEARENV \
+    $_ENV -i -- \
     $_VCONTEXT   --migrate-self --endsetup --chroot $SILENT_OPT "${OPTS_VCONTEXT_MIGRATE[@]}" -- \
     "${INITCMD_START[@]}"
 else
@@ -117,7 +117,7 @@ else
     $_EXEC_ULIMIT      "$VSERVER_DIR/ulimits" \
     $_CHCONTEXT_COMPAT "${CHCONTEXT_OPTS[@]}" "${CHCONTEXT_INIT_OPTS[@]}" \
     $_SAVE_CTXINFO     "$VSERVER_DIR" \
-    $_CLEARENV \
+    $_ENV -i -- \
     $_CHAINECHO "${_IS_FAKEINIT:+$startsync_pipe}" "" \
     $_CAPCHROOT        "${CAPCHROOT_OPTS[@]}" . \
     "${INITCMD_START[@]}"
index 8f57858..7365f77 100644 (file)
@@ -51,7 +51,6 @@ DIETPROGS +=          src/chcontext-compat \
                        src/chbind \
                        src/chroot-cat \
                        src/chroot-rm \
-                       src/clearenv \
                        src/exec-cd \
                        src/fakerunlevel \
                        src/keep-ctx-alive \
@@ -96,7 +95,6 @@ pkglib_PROGRAMS +=    src/capchroot \
                        src/chcontext-compat \
                        src/chroot-cat \
                        src/chroot-rm \
-                       src/clearenv \
                        src/fakerunlevel \
                        src/filetime \
                        src/keep-ctx-alive \
@@ -169,7 +167,6 @@ src_filetime_LDFLAGS                =  $(VSERVER_LDFLAGS)
 src_chain_echo_SOURCES         =  src/chain-echo.c
 src_chroot_cat_SOURCES         =  src/chroot-cat.c
 src_chroot_rm_SOURCES          =  src/chroot-rm.c
-src_clearenv_SOURCES           =  src/clearenv.c
 src_exec_cd_SOURCES            =  src/exec-cd.c
 src_fakerunlevel_SOURCES       =  src/fakerunlevel.c
 src_ifspec_SOURCES             =  src/ifspec.c
diff --git a/util-vserver/src/clearenv.c b/util-vserver/src/clearenv.c
deleted file mode 100644 (file)
index 73e7272..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// $Id$    --*- c -*--
-
-// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-//  
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//  
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//  
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include "util.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <libgen.h>
-
-static void
-showHelp(int fd, char const *cmd, int res)
-{
-  VSERVER_DECLARE_CMD(cmd);
-  
-  WRITE_MSG(fd, "Usage:  ");
-  WRITE_STR(fd, cmd);
-  WRITE_MSG(fd,
-           " <cmd> <args>*\n\n"
-           "Please report bugs to " PACKAGE_BUGREPORT "\n");
-  exit(res);
-}
-
-static void
-showVersion()
-{
-  WRITE_MSG(1,
-           "clearenv " VERSION " -- executes commands in a clean environment\n"
-           "This program is part of " PACKAGE_STRING "\n\n"
-           "Copyright (C) 2003 Enrico Scholz\n"
-           VERSION_COPYRIGHT_DISCLAIMER);
-  exit(0);
-}
-
-
-int main(int argc, char *argv[])
-{
-  int          idx = 1;
-  char *       env[] = { 0 };
-
-  if (argc>=2) {
-    if (strcmp(argv[1], "--help")   ==0) showHelp(1, argv[0], 0);
-    if (strcmp(argv[1], "--version")==0) showVersion();
-    if (strcmp(argv[1], "--")       ==0) ++idx;
-  }
-
-  if (argc<idx+1) {
-    WRITE_MSG(2, "Not enough parameters; use '--help' for more information\n");
-   return 255;
-  }
-
-  execve(argv[idx], argv+idx, env);
-  perror("clearenv: execve()");
-  return 255;
-}