X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fchroot-sh.c;fp=src%2Fchroot-sh.c;h=1dc696ab9c01673d616b063b03d932bafea53b0b;hb=83109802d0b4ab88856b6fe5ad270bac6967a531;hp=0e1ffdae58d4aafa9ad2b3773ef876b29363079e;hpb=d915349328969ca06e81d6e338239d9ae35c4704;p=util-vserver.git diff --git a/src/chroot-sh.c b/src/chroot-sh.c index 0e1ffda..1dc696a 100644 --- a/src/chroot-sh.c +++ b/src/chroot-sh.c @@ -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); }