From 173a6393eb366c7484bb853c1be152614c499bed Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Mon, 26 Nov 2018 12:53:39 +0000 Subject: [PATCH] remove chroot notice from zpm-script --- zpm-script.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/zpm-script.c b/zpm-script.c index ba057ef..7c03b24 100644 --- a/zpm-script.c +++ b/zpm-script.c @@ -30,11 +30,12 @@ void usage(void) { } int setdir(char *rootdir) { + if (chdir(rootdir ? rootdir : "/") == -1) { + perror("can not chdir to rootdir"); + return 0; + } +#if 0 if (rootdir && strcmp(rootdir, "/")) { - if (chdir(rootdir) == -1) { - perror("can not chdir to rootdir"); - return 0; - } if (geteuid() == 0) { /* chroot is deprecated, and not in posix. need to use * OS/kernel specific code. @@ -43,12 +44,8 @@ int setdir(char *rootdir) { } else { fprintf(stderr, "unable to chroot as non root user\n"); } - } else { - if (chdir("/") == -1) { - perror("can not chdir to /"); - return 0; - } } +#endif return 1; } -- 2.40.0