Skip to content

Commit

Permalink
lib: remove undocumented BAREOS_CFGDIR
Browse files Browse the repository at this point in the history
The configuration parser had set the undocumented and unused environment
variable BAREOS_CFGDIR, which could potentially have been used in
scripts and programs generating configuration snippets. However, as this
was never documented and is not used by Bareos itself, we remove it and
with it the need for setenv() and/or putenv().
  • Loading branch information
arogge committed Nov 2, 2021
1 parent 0bc60ca commit f107ddc
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 33 deletions.
2 changes: 0 additions & 2 deletions core/cmake/BareosCheckFunctions.cmake
Expand Up @@ -73,10 +73,8 @@ check_function_exists(openat HAVE_OPENAT)
check_function_exists(poll HAVE_POLL)
check_function_exists(posix_fadvise HAVE_POSIX_FADVISE)
check_function_exists(prctl HAVE_PRCTL)
check_function_exists(putenv HAVE_PUTENV)
check_function_exists(readdir_r HAVE_READDIR_R)
check_function_exists(setea HAVE_SETEA)
check_function_exists(setenv HAVE_SETENV)
check_function_exists(setproplist HAVE_SETPROPLIST)
check_function_exists(setreuid HAVE_SETREUID)
check_function_exists(setxattr HAVE_SETXATTR)
Expand Down
6 changes: 0 additions & 6 deletions core/src/include/config.h.in
Expand Up @@ -397,9 +397,6 @@ extern char win_os[];
// Define to 1 if you have the `prctl' function
#cmakedefine HAVE_PRCTL @HAVE_PRCTL@

// Define to 1 if you have the `putenv' function
#cmakedefine HAVE_PUTENV @HAVE_PUTENV@

// Define to 1 if you have the <pwd.h> header file
#cmakedefine HAVE_PWD_H @HAVE_PWD_H@

Expand Down Expand Up @@ -427,9 +424,6 @@ extern char win_os[];
// Define to 1 if you have the `setea' function
#cmakedefine HAVE_SETEA @HAVE_SETEA@

// Define to 1 if you have the `setenv' function
#cmakedefine HAVE_SETENV @HAVE_SETENV@

// Define to 1 if you have the `setproplist' function
#cmakedefine HAVE_SETPROPLIST @HAVE_SETPROPLIST@

Expand Down
19 changes: 0 additions & 19 deletions core/src/lib/parse_conf.cc
Expand Up @@ -411,23 +411,6 @@ const char* ConfigurationParser::GetDefaultConfigDir()
#endif
}

#ifdef HAVE_SETENV
static inline void set_env(const char* key, const char* value)
{
setenv(key, value, 1);
}
#elif HAVE_PUTENV
static inline void set_env(const char* key, const char* value)
{
PoolMem env_string;

Mmsg(env_string, "%s=%s", key, value);
putenv(strdup(env_string.c_str()));
}
#else
static inline void set_env(const char* key, const char* value) {}
#endif

bool ConfigurationParser::GetConfigFile(PoolMem& full_path,
const char* config_dir,
const char* config_filename)
Expand Down Expand Up @@ -539,8 +522,6 @@ bool ConfigurationParser::FindConfigPath(PoolMem& full_path)
cf_.c_str());
}

if (found) { set_env("BAREOS_CFGDIR", config_dir_.c_str()); }

return found;
}

Expand Down
6 changes: 0 additions & 6 deletions core/src/win32/compat/include/mingwconfig.h
Expand Up @@ -78,12 +78,6 @@
/* Define to 1 if you have the <resolv.h> header file. */
/* #undef HAVE_RESOLV_H */

/* Define to 1 if you have the `setenv' function. */
/* #undef HAVE_SETENV */

/* Define to 1 if you have the `putenv' function. */
#define HAVE_PUTENV 1

/* Define to 1 if translation of program messages to the user's native
language is requested. */
#if (defined _MSC_VER) && (_MSC_VER >= 1400) // VC8+
Expand Down

0 comments on commit f107ddc

Please sign in to comment.