X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=bacula%2Fsrc%2Flib%2Fparse_conf.c;h=1e432a640efe04f3d3e880b109b7ee73cc5f9648;hb=6872bd694d98711846adaae124f19dfc88d8f2e0;hp=71b988353ffa5a2c4cd5a135debe1029e105de65;hpb=a142d109c905a0309abc46ad43371ad3b3705010;p=bacula%2Fbacula diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index 71b988353f..1e432a640e 100755 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -33,19 +33,32 @@ * Version $Id$ */ /* - Copyright (C) 2000-2006 Kern Sibbald + Bacula® - The Network Backup Solution - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - version 2 as amended with additional clauses defined in the - file LICENSE in the main source directory. + Copyright (C) 2000-2006 Free Software Foundation Europe e.V. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - the file LICENSE for additional details. + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation plus additions + that are listed in the file LICENSE. - */ + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ #include "bacula.h" @@ -916,13 +929,16 @@ parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error, int err_type) const char *get_default_configdir() { #if defined(HAVE_WIN32) -#define DEFAULT_CONFIGDIR "C:\\Documents and Settings\\All Users\\Application Data\\Bacula" - HRESULT hr; static char szConfigDir[MAX_PATH + 1] = { 0 }; + if (!p_SHGetFolderPath) { + bstrncpy(szConfigDir, DEFAULT_CONFIGDIR, sizeof(szConfigDir)); + return szConfigDir; + } + if (szConfigDir[0] == '\0') { - hr = SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, szConfigDir); + hr = p_SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, szConfigDir); if (SUCCEEDED(hr)) { bstrncat(szConfigDir, "\\Bacula", sizeof(szConfigDir)); @@ -939,15 +955,9 @@ const char *get_default_configdir() bool find_config_file(const char *config_file, char *full_path) { -#if defined(HAVE_WIN32) - if (strpbrk(config_file, ":/\\") != NULL) { + if (first_path_separator(config_file) != NULL) { return false; } -#else - if (strchr(config_file, '/') != NULL) { - return false; - } -#endif struct stat st; @@ -965,8 +975,7 @@ find_config_file(const char *config_file, char *full_path) memcpy(full_path, config_dir, dir_length + 1); - if (full_path[dir_length - 1] != '/' && - full_path[dir_length - 1] != '\\') { + if (!IsPathSeparator(full_path[dir_length - 1])) { full_path[dir_length++] = '/'; }