Bladeren bron

* Make some realpath() calls non-fatal -- It is *expected* that the directories do not exist on these calls

Bryan Drewery 16 jaren geleden
bovenliggende
commit
454708748d
3 gewijzigde bestanden met toevoegingen van 7 en 5 verwijderingen
  1. 3 2
      src/conf.c
  2. 1 1
      src/main.c
  3. 3 2
      src/misc_file.c

+ 3 - 2
src/conf.c

@@ -1088,8 +1088,9 @@ bin_to_conf(bool error)
   }
 
   char datadir[PATH_MAX] = "";
-  if (!realpath(conf.datadir, datadir))
-    werr(ERR_DATADIR);
+  if (!realpath(conf.datadir, datadir)) {
+    ;
+  }
 
   str_redup(&conf.datadir, datadir);
   if (!mkdir_p(conf.datadir) && error)

+ 1 - 1
src/main.c

@@ -169,7 +169,7 @@ have_cwd:
 #endif /* CYGWIN_HACKS */
   /* Fix for symlinked binaries */
   if (!realpath(bin, buf))
-    fatal(STR("realpath() failed"), 0);
+    fatal(STR("realpath() failed on getting current working directory."), 0);
   size_t len = strlen(buf);
   bin = (char *) my_realloc(bin, len + 1);
   strlcpy(bin, buf, len + 1);

+ 3 - 2
src/misc_file.c

@@ -322,8 +322,9 @@ bool Tempfile::FindDir()
   };
 
   for (int i = 0; dirs[i]; i++) {
-    if (!realpath(dirs[i], tempdir))
-      continue;
+    if (!realpath(dirs[i], tempdir)) {
+      ;
+    }
     tempdir[(DIRMAX < PATH_MAX ? DIRMAX : PATH_MAX) - 1] = 0;
     size_t len = strlen(tempdir);
     tempdir[len] = '/';