setup now uses the new directory semantics
authorArt Cancro <ajc@citadel.org>
Sun, 31 Jan 2021 02:56:48 +0000 (21:56 -0500)
committerArt Cancro <ajc@citadel.org>
Sun, 31 Jan 2021 02:56:48 +0000 (21:56 -0500)
citadel/utils/setup.c

index 8a9214564c6d9b4bd8750b378e6cbf1fd90dae1c..9083fb8d48d77ed85d7808f161f2192c2ae2c69b 100644 (file)
@@ -694,9 +694,6 @@ int main(int argc, char *argv[])
        int curr;
        char buf[1024]; 
        char aaa[128];
-       int relh = 0;
-       int home = 0;
-       char relhome[PATH_MAX]="";
        char ctdldir[PATH_MAX]=CTDLDIR;
        struct passwd *pw;
        gid_t gid;
@@ -716,19 +713,16 @@ int main(int argc, char *argv[])
                        setup_type = atoi(aaa);
                }
                else if (!strncmp(argv[a], "-h", 2)) {
-                       relh=argv[a][2]!='/';
-                       if (!relh) {
-                               safestrncpy(ctdl_home_directory, &argv[a][2], sizeof ctdl_home_directory);
-                       } else {
-                               safestrncpy(relhome, &argv[a][2], sizeof relhome);
-                       }
-                       home = 1;
+                       safestrncpy(ctdldir, &argv[a][2], sizeof ctdldir);
                }
        }
 
-       SetTitles();
+       if (chdir(ctdldir) != 0) {
+               fprintf(stderr, "sendcommand: %s: %s\n", ctdldir, strerror(errno));
+               exit(errno);
+       }
 
-       enable_home = ( relh | home );
+       SetTitles();
 
        /*
         * Connect to the running Citadel server.