X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fsave_ctxinfo.c;h=cfb26fa04f8aee8367447d22b608938bd3ffd6fb;hb=245184e3863bc621fd6a318fa51da348c1ef86d9;hp=f46ec12e03ca43864626dc6d31288deba23346a3;hpb=4c0037aecd96cf23da727c12381723ab5cbfa5e4;p=util-vserver.git diff --git a/util-vserver/src/save_ctxinfo.c b/util-vserver/src/save_ctxinfo.c index f46ec12..cfb26fa 100644 --- a/util-vserver/src/save_ctxinfo.c +++ b/util-vserver/src/save_ctxinfo.c @@ -25,14 +25,19 @@ #include "vserver.h" #include "internal.h" #include "util.h" -#include "wrappers.h" -#include "wrappers-vserver.h" #include #include #include #include #include +#include + +#define ENSC_WRAPPERS_PREFIX "save_ctxinfo: " +#define ENSC_WRAPPERS_VSERVER 1 +#define ENSC_WRAPPERS_UNISTD 1 +#define ENSC_WRAPPERS_FCNTL 1 +#include int wrapper_exit_code = 255; @@ -58,7 +63,7 @@ int main(int argc, char *argv[]) strcpy(runfile, argv[1]); strcpy(runfile+len1, "/run"); - ctx=Evc_X_getctx(0); + ctx=Evc_get_task_xid(0); if (ctx==0) { WRITE_MSG(2, "save_ctxinfo: Can not operate in context 0\n"); @@ -70,21 +75,22 @@ int main(int argc, char *argv[]) return 255; } - Ereadlink(runfile, dstfile, sizeof(dstfile)); - len = utilvserver_fmt_uint(buf, ctx); + len = EreadlinkD(runfile, dstfile, sizeof(dstfile)-1); + dstfile[len] = '\0'; + len = utilvserver_fmt_uint(buf, ctx); - fd = Eopen(dstfile, O_EXCL|O_CREAT|O_WRONLY, 0644); + fd = EopenD(dstfile, O_EXCL|O_CREAT|O_WRONLY, 0644); if (write(fd, buf, len) !=len || write(fd, "\n", 1) !=1) { - perror("write()"); + perror("save_ctxinfo: write()"); return -1; } Eclose(fd); strcat(runfile, ".rev/"); - strcat(runfile, buf); + strncat(runfile, buf, len); unlink(runfile); - Esymlink(argv[1], runfile); + EsymlinkD(argv[1], runfile); Eexecv(argv[2], argv+2); }