git://git.onelab.eu
/
util-vserver.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
merge to 0.30.212
[util-vserver.git]
/
src
/
chcontext.c
diff --git
a/src/chcontext.c
b/src/chcontext.c
index
fe66a22
..
e41203c
100644
(file)
--- a/
src/chcontext.c
+++ b/
src/chcontext.c
@@
-1,4
+1,4
@@
-// $Id: chcontext.c
,v 1.24 2005/03/22 15:05:24 ensc Exp
$
+// $Id: chcontext.c
2403 2006-11-24 23:06:08Z dhozac
$
// Copyright (C) 2003,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
// based on chcontext.cc by Jacques Gelinas
// Copyright (C) 2003,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
// based on chcontext.cc by Jacques Gelinas
@@
-95,6
+95,10
@@
static void
showHelp(int fd, char const *cmd, int res)
{
VSERVER_DECLARE_CMD(cmd);
showHelp(int fd, char const *cmd, int res)
{
VSERVER_DECLARE_CMD(cmd);
+
+#if !defined(VC_ENABLE_API_COMPAT) && !defined(VC_ENABLE_API_LEGACY)
+ WRITE_MSG(1, "ERROR: tools were built without legacy API support; chcontext will not work!\n\n");
+#endif
WRITE_MSG(fd, "Usage: ");
WRITE_STR(fd, cmd);
WRITE_MSG(fd, "Usage: ");
WRITE_STR(fd, cmd);
@@
-178,6
+182,8
@@
showVersion()
exit(0);
}
exit(0);
}
+#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
+
static inline void
setCap(char const *str, uint32_t *add_caps, uint32_t *remove_caps)
{
static inline void
setCap(char const *str, uint32_t *add_caps, uint32_t *remove_caps)
{
@@
-266,6
+272,9
@@
tellContext(xid_t ctx)
#include "context-sync.hc"
#include "context-sync.hc"
+#endif
+
+
int main (int argc, char *argv[])
{
struct Arguments args = {
int main (int argc, char *argv[])
{
struct Arguments args = {
@@
-278,10
+287,13
@@
int main (int argc, char *argv[])
.hostname = 0,
.domainname = 0
};
.hostname = 0,
.domainname = 0
};
+
+#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
xid_t newctx;
int xflags;
int p[2][2];
pid_t pid;
xid_t newctx;
int xflags;
int p[2][2];
pid_t pid;
+#endif
global_args = &args;
signal(SIGCHLD, SIG_DFL);
global_args = &args;
signal(SIGCHLD, SIG_DFL);
@@
-298,6
+310,7
@@
int main (int argc, char *argv[])
case CMD_DOMAINNAME : args.domainname = optarg; break;
case CMD_HOSTNAME : args.hostname = optarg; break;
case CMD_DOMAINNAME : args.domainname = optarg; break;
case CMD_HOSTNAME : args.hostname = optarg; break;
+#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
case CMD_CAP :
setCap(optarg, &args.add_caps, &args.remove_caps);
break;
case CMD_CAP :
setCap(optarg, &args.add_caps, &args.remove_caps);
break;
@@
-316,17
+329,23
@@
int main (int argc, char *argv[])
}
args.ctxs[args.nbctx++] = Evc_xidopt2xid(optarg, true);
break;
}
args.ctxs[args.nbctx++] = Evc_xidopt2xid(optarg, true);
break;
-
+#else
+ case CMD_CAP :
+ case CMD_SECURE :
+ case CMD_FLAG :
+ case CMD_CTX : break;
+#endif
default :
WRITE_MSG(2, "Try '");
WRITE_STR(2, argv[0]);
default :
WRITE_MSG(2, "Try '");
WRITE_STR(2, argv[0]);
- WRITE_MSG(2, " --help
\"
for more information.\n");
+ WRITE_MSG(2, " --help
'
for more information.\n");
return 255;
break;
}
}
return 255;
break;
}
}
+#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
if (optind>=argc) {
WRITE_MSG(2, "No command given; use '--help' for more information.\n");
exit(255);
if (optind>=argc) {
WRITE_MSG(2, "No command given; use '--help' for more information.\n");
exit(255);
@@
-364,8
+383,14
@@
int main (int argc, char *argv[])
waitOnSync(pid, p, args.ctxs[0]!=VC_DYNAMIC_XID);
return EXIT_SUCCESS;
waitOnSync(pid, p, args.ctxs[0]!=VC_DYNAMIC_XID);
return EXIT_SUCCESS;
+#else
+ WRITE_MSG(2, "chcontext: tools were built without legacy API support; can not continue\n");
+ return EXIT_FAILURE;
+#endif
}
}
+#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
+
#ifdef ENSC_TESTSUITE
#define FLAG_TEST(STR,EXP) \
{ \
#ifdef ENSC_TESTSUITE
#define FLAG_TEST(STR,EXP) \
{ \
@@
-394,3
+419,7
@@
test()
CAP_TEST("!CAP_CHOWN", 0, 1);
}
#endif
CAP_TEST("!CAP_CHOWN", 0, 1);
}
#endif
+
+#else
+void test() {}
+#endif