]> pd.if.org Git - zpackage/commitdiff
remove chroot notice from zpm-script
authorNathan Wagner <nw@hydaspes.if.org>
Mon, 26 Nov 2018 12:53:39 +0000 (12:53 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Mon, 26 Nov 2018 12:53:39 +0000 (12:53 +0000)
zpm-script.c

index ba057ef72303d2e02d358fc2d6a10d785d62aafd..7c03b241792ae1f91ea504215b1400526580c71b 100644 (file)
@@ -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;
 }