X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fchroot-sh.c;h=4cbca21f433221bff06b1c807fd90e1e2b9f4c74;hb=b0a62d195efca12c5cb9e7c0b3bea3be2cd57fc9;hp=f8baac3a0abef03bcf0be6557c6296f346bd8deb;hpb=fc28db1eb4146796ec27c2fb15780d6303120261;p=util-vserver.git diff --git a/src/chroot-sh.c b/src/chroot-sh.c index f8baac3..4cbca21 100644 --- a/src/chroot-sh.c +++ b/src/chroot-sh.c @@ -1,4 +1,4 @@ -// $Id: chroot-sh.c 2407 2006-11-25 19:18:06Z dhozac $ --*- c -*-- +// $Id: chroot-sh.c 2536 2007-04-27 09:01:20Z hollow $ --*- c -*-- // Copyright (C) 2005 Enrico Scholz // @@ -192,6 +192,24 @@ execChmod(int argc, char *argv[]) return res; } +static int +execLink(int argc, char *argv[]) +{ + int res = EXIT_SUCCESS; + + if (argc!=3) { + WRITE_MSG(2, "Need exactly two files for 'link' operation; try '--help' for more information\n"); + return wrapper_exit_code; + } + + if (symlink(argv[1], argv[2])==-1) { + PERROR_Q(ENSC_WRAPPERS_PREFIX "link", argv[1]); + res = EXIT_FAILURE; + } + + return res; +} + static struct Command { char const *cmd; int (*handler)(int argc, char *argv[]); @@ -203,6 +221,7 @@ static struct Command { { "rm", execRm }, { "mkdir", execMkdir }, { "chmod", execChmod }, + { "link", execLink }, { 0,0 } }; @@ -224,7 +243,8 @@ showHelp() " rm + ... unlink the given files\n" " mkdir + ... create the given directories\n" " chmod +\n" - " ... change access permissions of files\n\n" + " ... change access permissions of files\n" + " link dst> ... create a symbolic link from to \n\n" "Please report bugs to " PACKAGE_BUGREPORT "\n"); exit(0); }