From 19b505f485927357115dcd74d4576f5c7f4dd995 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 20 Feb 2004 16:59:40 +0000 Subject: [PATCH] do not do the lo-check anymore git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@965 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/src/chcontext.c | 7 ++++--- util-vserver/src/clearenv.c | 2 +- util-vserver/src/exec-cd.c | 4 +++- util-vserver/src/exec-ulimit.c | 2 ++ util-vserver/src/ifspec.c | 4 ++-- util-vserver/src/listdevip.c | 4 ++-- util-vserver/src/new-namespace.c | 5 +++-- util-vserver/src/reducecap.c | 3 ++- util-vserver/src/rpm-fake-resolver.c | 2 ++ util-vserver/src/rpm-fake.c | 2 +- util-vserver/src/save_ctxinfo.c | 10 ++++++---- util-vserver/src/secure-mount.c | 34 +++++++++++++++++----------------- util-vserver/src/vkill.c | 8 ++++---- 13 files changed, 49 insertions(+), 38 deletions(-) diff --git a/util-vserver/src/chcontext.c b/util-vserver/src/chcontext.c index e6e7425..4c4c529 100644 --- a/util-vserver/src/chcontext.c +++ b/util-vserver/src/chcontext.c @@ -39,6 +39,7 @@ #include #include +#define ENSC_WRAPPERS_PREFIX "chcontext: " #define ENSC_WRAPPERS_VSERVER 1 #define ENSC_WRAPPERS_UNISTD 1 #define ENSC_WRAPPERS_FCNTL 1 @@ -217,7 +218,7 @@ setHostname(char const *name) if (name == NULL) return; if (sethostname(name, strlen(name))==-1) { - perror("sethostname()"); + perror("chcontext: sethostname()"); exit(255); } if (!global_args->do_silent) { @@ -233,7 +234,7 @@ setDomainname(char const *name) if (name == NULL) return; if (setdomainname(name, strlen(name))==-1) { - perror("setdomainname()"); + perror("chcontext: setdomainname()"); exit(255); } if (!global_args->do_silent) { @@ -396,7 +397,7 @@ int main (int argc, char *argv[]) execvp (argv[optind],argv+optind); doSyncStage2(p); - perror("execvp()"); + perror("chcontext: execvp()"); exit(255); } diff --git a/util-vserver/src/clearenv.c b/util-vserver/src/clearenv.c index 6cd73a5..c9e7062 100644 --- a/util-vserver/src/clearenv.c +++ b/util-vserver/src/clearenv.c @@ -67,6 +67,6 @@ int main(int argc, char *argv[]) } execve(argv[1], argv+1, env); - perror("execve()"); + perror("clearenv: execve()"); return 255; } diff --git a/util-vserver/src/exec-cd.c b/util-vserver/src/exec-cd.c index 4250f72..0c47459 100644 --- a/util-vserver/src/exec-cd.c +++ b/util-vserver/src/exec-cd.c @@ -22,7 +22,9 @@ #include "util.h" #include +#include +#define ENSC_WRAPPERS_PREFIX "exec-cd: " #define ENSC_WRAPPERS_FCNTL 1 #define ENSC_WRAPPERS_UNISTD 1 #include @@ -35,7 +37,7 @@ showHelp(int fd, char const *cmd, int res) WRITE_MSG(fd, "Usage: "); WRITE_STR(fd, cmd); WRITE_MSG(fd, - "[--] *\n\n" + " [--] *\n\n" "Please report bugs to " PACKAGE_BUGREPORT "\n"); exit(res); } diff --git a/util-vserver/src/exec-ulimit.c b/util-vserver/src/exec-ulimit.c index a4ff4f8..39dc59e 100644 --- a/util-vserver/src/exec-ulimit.c +++ b/util-vserver/src/exec-ulimit.c @@ -26,7 +26,9 @@ #include #include #include +#include +#define ENSC_WRAPPERS_PREFIX "exec-ulimit: " #define ENSC_WRAPPERS_UNISTD 1 #define ENSC_WRAPPERS_FCNTL 1 #define ENSC_WRAPPERS_RESOURCE 1 diff --git a/util-vserver/src/ifspec.c b/util-vserver/src/ifspec.c index 57ae0d0..6121615 100644 --- a/util-vserver/src/ifspec.c +++ b/util-vserver/src/ifspec.c @@ -124,7 +124,7 @@ int ifconfig_print ( ret = 0; } else { - perror("ioctl(SIOCGIFADDR)"); + perror("ifspec: ioctl(SIOCGIFADDR)"); } if (maskstr != NULL && maskstr[0] != '\0'){ @@ -142,7 +142,7 @@ int ifconfig_print ( ret = 0; } else { - perror("ioctl(SIOCGIFNETMASK)"); + perror("ifspec: ioctl(SIOCGIFNETMASK)"); } if (bcaststr != NULL && bcaststr[0] != '\0'){ diff --git a/util-vserver/src/listdevip.c b/util-vserver/src/listdevip.c index e0e9486..abcbe7c 100644 --- a/util-vserver/src/listdevip.c +++ b/util-vserver/src/listdevip.c @@ -52,7 +52,7 @@ static int devlist_read2_2() int ret = -1; int skfd = socket (AF_INET,SOCK_DGRAM,0); if (skfd < 0) { - perror ("socket"); + perror ("listdevip: socket()"); }else{ struct ifconf ifc; int numreqs = 30; @@ -63,7 +63,7 @@ static int devlist_read2_2() ifc.ifc_buf = (char*)realloc(ifc.ifc_buf, ifc.ifc_len); if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) { - perror("SIOCGIFCONF"); + perror("listdevip: SIOCGIFCONF"); ret = -1; break; } diff --git a/util-vserver/src/new-namespace.c b/util-vserver/src/new-namespace.c index 43862fc..e337bee 100644 --- a/util-vserver/src/new-namespace.c +++ b/util-vserver/src/new-namespace.c @@ -38,6 +38,7 @@ #include #include +#define ENSC_WRAPPERS_PREFIX "new-namespace: " #define ENSC_WRAPPERS_WAIT 1 #include @@ -92,11 +93,11 @@ int main(int argc, char *argv[]) #endif switch (pid) { case -1 : - perror("clone()"); + perror("new-namespace: clone()"); exit(wrapper_exit_code); case 0 : execvp(argv[1], argv+1); - perror("execvp()"); + perror("new-namespace: execvp()"); exit(wrapper_exit_code); default : exitLikeProcess(pid); diff --git a/util-vserver/src/reducecap.c b/util-vserver/src/reducecap.c index caf6407..9999f61 100644 --- a/util-vserver/src/reducecap.c +++ b/util-vserver/src/reducecap.c @@ -34,6 +34,7 @@ #include "linuxcaps.h" +#define ENSC_WRAPPERS_PREFIX "reducecap: " #define ENSC_WRAPPERS_VSERVER 1 #define ENSC_WRAPPERS_UNISTD 1 #include @@ -199,7 +200,7 @@ show(pid_t pid) header.version = _LINUX_CAPABILITY_VERSION; header.pid = pid; if (capget(&header,&user)==-1){ - perror ("capget"); + perror ("reducecap: capget()"); exit(wrapper_exit_code); } diff --git a/util-vserver/src/rpm-fake-resolver.c b/util-vserver/src/rpm-fake-resolver.c index e8ffce3..b9abdd6 100644 --- a/util-vserver/src/rpm-fake-resolver.c +++ b/util-vserver/src/rpm-fake-resolver.c @@ -30,7 +30,9 @@ #include #include #include +#include +#define ENSC_WRAPPERS_PREFIX "rpm-fake-resolver: " #define ENSC_WRAPPERS_VSERVER 1 #define ENSC_WRAPPERS_UNISTD 1 #define ENSC_WRAPPERS_FCNTL 1 diff --git a/util-vserver/src/rpm-fake.c b/util-vserver/src/rpm-fake.c index 85347c5..5e44a08 100644 --- a/util-vserver/src/rpm-fake.c +++ b/util-vserver/src/rpm-fake.c @@ -181,7 +181,7 @@ initPwSocket() connect(pw_sock, (struct sockaddr *)(&addr), sizeof addr)==-1 || (flag=fcntl(pw_sock, F_GETFD))==-1 || fcntl(pw_sock, F_SETFD, flag | FD_CLOEXEC)==-1) { - perror("error while initializing pw-socket"); + perror("rpm-fake.so: error while initializing pw-socket"); exit(255); } } diff --git a/util-vserver/src/save_ctxinfo.c b/util-vserver/src/save_ctxinfo.c index 5bd0e22..2dd49f0 100644 --- a/util-vserver/src/save_ctxinfo.c +++ b/util-vserver/src/save_ctxinfo.c @@ -31,10 +31,12 @@ #include #include #include +#include -#define ENSC_WRAPPERS_VSERVER 1 -#define ENSC_WRAPPERS_UNISTD 1 -#define ENSC_WRAPPERS_FCNTL 1 +#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; @@ -79,7 +81,7 @@ int main(int argc, char *argv[]) fd = Eopen(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); diff --git a/util-vserver/src/secure-mount.c b/util-vserver/src/secure-mount.c index 7a48ff3..bc90769 100644 --- a/util-vserver/src/secure-mount.c +++ b/util-vserver/src/secure-mount.c @@ -260,23 +260,23 @@ updateMtab(struct MountInfo const *mnt, struct Options const *opt) if (opt->rootdir!=0 && chroot(opt->rootdir)==-1) { - perror("chroot()"); + perror("secure-mount: chroot()"); return -1; } fd=open(opt->mtab, O_CREAT|O_APPEND|O_WRONLY, 0644); - if (fd==-1) perror("open()"); + if (fd==-1) perror("secure-mount: open()"); if (fchroot(opt->cur_rootdir_fd)==-1) { - perror("fchroot()"); + perror("secure-mount: fchroot()"); goto err1; } if (fd==-1) goto err0; if (flock(fd, LOCK_EX)==-1) { - perror("flock()"); + perror("secure-mount: flock()"); goto err1; } @@ -289,7 +289,7 @@ updateMtab(struct MountInfo const *mnt, struct Options const *opt) writeStrX(fd, " ")==-1 || writeStrX(fd, mnt->data ? mnt->data : "defaults")==-1 || writeStrX(fd, " 0 0\n")==-1) { - perror("write()"); + perror("secure-mount: write()"); goto err1; } @@ -332,18 +332,18 @@ callExternalMount(struct MountInfo const *mnt) pid = fork(); if (pid==-1) { - perror("fork()"); + perror("secure-mount: fork()"); return false; } if (pid==0) { execv(mount_prog, const_cast(char **)(argv)); - perror("execv()"); + perror("secure-mount: execv()"); exit(1); } if (wait4(pid, &status, 0, 0)==-1) { - perror("wait4()"); + perror("secure-mount: wait4()"); return false; } @@ -359,7 +359,7 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt) if (opt->rootdir!=0) { if (chdir(opt->rootdir)==-1) { - perror("chdir()"); + perror("secure-mount: chdir()"); return false; } @@ -368,14 +368,14 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt) if (opt->is_secure) { if (chdirSecure(dir)==-1) { - perror("chdirSecure()"); + perror("secure-mount: chdirSecure()"); return false; } } else { if (*dir!='\0' && chdir(dir)==-1) { - perror("chdir()"); + perror("secure-mount: chdir()"); return false; } } @@ -384,7 +384,7 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt) if (mount(mnt->src, ".", mnt->type ? mnt->type : "", mnt->flags, mnt->data)==-1) { - perror("mount()"); + perror("secure-mount: mount()"); return false; } } @@ -396,7 +396,7 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt) if ((mnt->flags&MS_BIND) && opt->rootdir!=0 && (verifyPosition(mnt->src, opt->rootdir, mnt->dst)==-1 || fchroot(opt->cur_rootdir_fd)==-1)) { - perror("verifyPosition/fchroot"); + perror("secure-mount: verifyPosition/fchroot"); // TODO: what is with unmounting? return false; } @@ -489,14 +489,14 @@ mountFstab(struct Options const *opt) assert(opt->fstab!=0); fd = open(opt->fstab, O_RDONLY); if (fd==-1) { - perror("open()"); + perror("secure-mount: open()"); goto err0; } len = lseek(fd, 0, SEEK_END); if (len==-1 || lseek(fd, 0, SEEK_SET)==-1) { - perror("lseek()"); + perror("secure-mount: lseek()"); goto err1; } @@ -505,7 +505,7 @@ mountFstab(struct Options const *opt) char *ptr, *ptrptr; if (read(fd, buf, len+1)!=len) { - perror("read()"); + perror("secure-mount: read()"); goto err1; } buf[len] = '#'; // workaround for broken dietlibc strtok_r() @@ -571,7 +571,7 @@ int main(int argc, char *argv[]) opt.cur_rootdir_fd = open("/", O_RDONLY|O_DIRECTORY); if (opt.cur_rootdir_fd==-1) { - perror("open(\"/\")"); + perror("secure-mount: open(\"/\")"); return EXIT_FAILURE; } diff --git a/util-vserver/src/vkill.c b/util-vserver/src/vkill.c index 52f8409..dad9cb7 100644 --- a/util-vserver/src/vkill.c +++ b/util-vserver/src/vkill.c @@ -108,7 +108,7 @@ kill_wrapper_legacy(xid_t UNUSED ctx, char const *proc, int UNUSED sig) { pid_t pid = fork(); if (pid==-1) { - perror("fork()"); + perror("vkill: fork()"); exit(1); } else if (pid==0) { @@ -121,7 +121,7 @@ kill_wrapper_legacy(xid_t UNUSED ctx, char const *proc, int UNUSED sig) } execl(LEGACYDIR "/vkill", "legacy/vkill", proc, (void *)(0)); - perror("execl()"); + perror("vkill: execl()"); exit(1); } @@ -135,7 +135,7 @@ kill_wrapper(xid_t ctx, char const *pid, int sig) return kill_wrapper_legacy(ctx, pid, sig); else { errno = err; - perror("vc_ctx_kill()"); + perror("vkill: vc_ctx_kill()"); return 1; } } @@ -147,7 +147,7 @@ inline static int kill_wrapper(xid_t ctx, char const *pid, int sig) { if (vc_ctx_kill(ctx,atoi(pid),sig)==-1) { - perror("vc_ctx_kill()"); + perror("vkill: vc_ctx_kill()"); return 1; } return 0; -- 1.8.1.5