]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
fix bsys path split
authornorbert.bizet <norbert.bizet@baculasystems.com>
Tue, 15 Nov 2022 09:43:11 +0000 (04:43 -0500)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:00 +0000 (13:57 +0200)
bacula/src/lib/bsys.c

index b151c155530cfb8f889033b0e781b975af2af3a5..0b1c879d813ce3f0797cadbc15c1ac335836561a 100644 (file)
@@ -2045,7 +2045,11 @@ void get_path_and_fname(const char *name, char **path, char **fname)
       /* separate exepath from exename */
       *l = 0;
       *path = bstrdup(cargv0);
+#if defined(HAVE_WIN32)
+      if (strstr(*path, PathSeparatorUp) != NULL || strstr(*fname, PathSeparatorCur) != NULL) {
+#else
       if (strstr(*path, PathSeparatorUp) != NULL || strstr(*fname, PathSeparatorCur) != NULL || !IsPathSeparator(*path[0])) {
+#endif
          /* fallback to legacy code */
          if (getcwd(cpath, path_max)) {
             free(*path);