#include <assert.h>
#include <fcntl.h>
+#define ENSC_WRAPPERS_PREFIX "chcontext: "
#define ENSC_WRAPPERS_VSERVER 1
#define ENSC_WRAPPERS_UNISTD 1
#define ENSC_WRAPPERS_FCNTL 1
if (name == NULL) return;
if (sethostname(name, strlen(name))==-1) {
- perror("sethostname()");
+ perror("chcontext: sethostname()");
exit(255);
}
if (!global_args->do_silent) {
if (name == NULL) return;
if (setdomainname(name, strlen(name))==-1) {
- perror("setdomainname()");
+ perror("chcontext: setdomainname()");
exit(255);
}
if (!global_args->do_silent) {
execvp (argv[optind],argv+optind);
doSyncStage2(p);
- perror("execvp()");
+ perror("chcontext: execvp()");
exit(255);
}
}
execve(argv[1], argv+1, env);
- perror("execve()");
+ perror("clearenv: execve()");
return 255;
}
#include "util.h"
#include <fcntl.h>
+#include <errno.h>
+#define ENSC_WRAPPERS_PREFIX "exec-cd: "
#define ENSC_WRAPPERS_FCNTL 1
#define ENSC_WRAPPERS_UNISTD 1
#include <wrappers.h>
WRITE_MSG(fd, "Usage: ");
WRITE_STR(fd, cmd);
WRITE_MSG(fd,
- "[--] <dir> <cmd> <args>*\n\n"
+ " [--] <dir> <cmd> <args>*\n\n"
"Please report bugs to " PACKAGE_BUGREPORT "\n");
exit(res);
}
#include <sys/resource.h>
#include <unistd.h>
#include <fcntl.h>
+#include <errno.h>
+#define ENSC_WRAPPERS_PREFIX "exec-ulimit: "
#define ENSC_WRAPPERS_UNISTD 1
#define ENSC_WRAPPERS_FCNTL 1
#define ENSC_WRAPPERS_RESOURCE 1
ret = 0;
}
else {
- perror("ioctl(SIOCGIFADDR)");
+ perror("ifspec: ioctl(SIOCGIFADDR)");
}
if (maskstr != NULL && maskstr[0] != '\0'){
ret = 0;
}
else {
- perror("ioctl(SIOCGIFNETMASK)");
+ perror("ifspec: ioctl(SIOCGIFNETMASK)");
}
if (bcaststr != NULL && bcaststr[0] != '\0'){
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;
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;
}
#include <sys/wait.h>
#include <libgen.h>
+#define ENSC_WRAPPERS_PREFIX "new-namespace: "
#define ENSC_WRAPPERS_WAIT 1
#include <wrappers.h>
#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);
#include "linuxcaps.h"
+#define ENSC_WRAPPERS_PREFIX "reducecap: "
#define ENSC_WRAPPERS_VSERVER 1
#define ENSC_WRAPPERS_UNISTD 1
#include <wrappers.h>
header.version = _LINUX_CAPABILITY_VERSION;
header.pid = pid;
if (capget(&header,&user)==-1){
- perror ("capget");
+ perror ("reducecap: capget()");
exit(wrapper_exit_code);
}
#include <grp.h>
#include <pwd.h>
#include <fcntl.h>
+#include <errno.h>
+#define ENSC_WRAPPERS_PREFIX "rpm-fake-resolver: "
#define ENSC_WRAPPERS_VSERVER 1
#define ENSC_WRAPPERS_UNISTD 1
#define ENSC_WRAPPERS_FCNTL 1
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);
}
}
#include <fcntl.h>
#include <stdio.h>
#include <limits.h>
+#include <errno.h>
-#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 <wrappers.h>
int wrapper_exit_code = 255;
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);
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(<mtab>)");
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;
}
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;
}
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;
}
if (opt->rootdir!=0) {
if (chdir(opt->rootdir)==-1) {
- perror("chdir()");
+ perror("secure-mount: chdir()");
return false;
}
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;
}
}
if (mount(mnt->src, ".",
mnt->type ? mnt->type : "",
mnt->flags, mnt->data)==-1) {
- perror("mount()");
+ perror("secure-mount: mount()");
return false;
}
}
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;
}
assert(opt->fstab!=0);
fd = open(opt->fstab, O_RDONLY);
if (fd==-1) {
- perror("open(<fstab>)");
+ perror("secure-mount: open(<fstab>)");
goto err0;
}
len = lseek(fd, 0, SEEK_END);
if (len==-1 ||
lseek(fd, 0, SEEK_SET)==-1) {
- perror("lseek(<fstab>)");
+ perror("secure-mount: lseek(<fstab>)");
goto err1;
}
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()
opt.cur_rootdir_fd = open("/", O_RDONLY|O_DIRECTORY);
if (opt.cur_rootdir_fd==-1) {
- perror("open(\"/\")");
+ perror("secure-mount: open(\"/\")");
return EXIT_FAILURE;
}
{
pid_t pid = fork();
if (pid==-1) {
- perror("fork()");
+ perror("vkill: fork()");
exit(1);
}
else if (pid==0) {
}
execl(LEGACYDIR "/vkill", "legacy/vkill", proc, (void *)(0));
- perror("execl()");
+ perror("vkill: execl()");
exit(1);
}
return kill_wrapper_legacy(ctx, pid, sig);
else {
errno = err;
- perror("vc_ctx_kill()");
+ perror("vkill: vc_ctx_kill()");
return 1;
}
}
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;