Parcourir la source

* Don't auto move binary to binpath/binname

Bryan Drewery il y a 16 ans
Parent
commit
956ac96b56
4 fichiers modifiés avec 2 ajouts et 77 suppressions
  1. 1 6
      src/binary.c
  2. 0 4
      src/main.c
  3. 1 64
      src/shell.c
  4. 0 3
      src/shell.h

+ 1 - 6
src/binary.c

@@ -687,12 +687,7 @@ void conf_to_bin(conf_t *in, bool move, int die)
                            bot->net.ip6 ? bot->net.ip6 : "");
     }
 
-#ifndef CYGWIN_HACKS
-  if (move)
-    newbin = move_bin(in->binpath, in->binname, 0);
-  else
-#endif /* !CYGWIN_HACKS */
-    newbin = binname;
+  newbin = binname;
 //  tellconfig(&settings); 
   write_settings(newbin, -1, 1);
 

+ 0 - 4
src/main.c

@@ -652,10 +652,6 @@ static void startup_checks(int hack) {
   if (!can_stat(binname))
    werr(ERR_BINSTAT);
 
-#ifndef CYGWIN_HACKS
-  move_bin(conf.binpath, conf.binname, 1);
-#endif /* !CYGWIN_HACKS */
-
   fill_conf_bot();
 //  if (((!conf.bot || !conf.bot->nick) || (!conf.bot->hub && conf.bot->localhub)) && !used_B) {
   if (!used_B) {

+ 1 - 64
src/shell.c

@@ -762,70 +762,6 @@ void expand_tilde(char **ptr)
   }
 }
 
-#ifndef CYGWIN_HACKS
-char *move_bin(const char *ipath, const char *file, bool run)
-{
-  char *path = strdup(ipath);
-
-  expand_tilde(&path);
-
-  /* move the binary to the correct place */
-  static char newbin[DIRMAX] = "";
-  char real[PATH_MAX] = "";
-
-  simple_snprintf(newbin, sizeof newbin, "%s%s%s", path, path[strlen(path) - 1] == '/' ? "" : "/", file);
-
-  ContextNote(STR("realpath()"));
-  if (!realpath(binname, real))            /* get the realpath of binname */
-    fatal(STR("Unable to determine binary path."), 0);
-  real[(DIRMAX < PATH_MAX ? DIRMAX : PATH_MAX) - 1] = 0;
-  ContextNote(STR("realpath(): Success"));
-  /* running from wrong dir, or wrong bin name.. lets try to fix that :) */
-  sdprintf(STR("binname: %s"), binname);
-  sdprintf(STR("newbin: %s"), newbin);
-  sdprintf(STR("real: %s"), real);
-  if (strcmp(binname, newbin) && strcmp(newbin, real)) {              /* if wrong path and new path != current */
-    bool ok = 1;
-
-    sdprintf(STR("wrong dir, is: %s :: %s"), binname, newbin);
-
-    unlink(newbin);
-    if (copyfile(binname, newbin))
-      ok = 0;
-
-    if (ok && !can_stat(newbin)) {
-       unlink(newbin);
-       ok = 0;
-    }
-
-    if (ok && fixmod(newbin)) {
-        unlink(newbin);
-        ok = 0;
-    }
-
-    if (ok) {
-      sdprintf(STR("Binary successfully moved to: %s"), newbin);
-      unlink(binname);
-      if (run) {
-        simple_snprintf(newbin, sizeof newbin, "%s%s%s", 
-                        path, path[strlen(path) - 1] == '/' ? "" : "/", shell_escape(file));
-        if (system(newbin) == -1) {
-          printf("Unable to automatically start new binary.\n");
-          exit(1);
-        }
-        sdprintf(STR("exiting to let new binary run..."));
-        exit(0);
-      }
-    } else {
-      if (run)
-        werr(ERR_WRONGBINDIR);
-      sdprintf(STR("Binary move failed to: %s"), newbin);
-      return binname;
-    }
-  }
-  return newbin;
-}
-
 void check_crontab()
 {
   int i = 0;
@@ -858,6 +794,7 @@ void crontab_del() {
   unlink(tmpFile);
 }
 
+#ifndef CYGWIN_HACKS
 int crontab_exists() {
   char buf[2048] = "", *out = NULL;
 

+ 0 - 3
src/shell.h

@@ -45,9 +45,6 @@ void check_mypid();
 void clear_tmp();
 char *homedir(bool = 1);
 char *my_username();
-#ifndef CYGWIN_HACKS
-char *move_bin(const char *, const char *, bool);
-#endif /* !CYGWIN_HACKS */
 void expand_tilde(char **);
 int email(char *, char *, int);
 int shell_exec(char *, char *, char **, char **);