summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-12-10 11:30:37 -0800
committerJeremy Allison <jra@samba.org>2007-12-10 11:30:37 -0800
commit7faee02d0d351c5c039e8f1be7e82ce3a93cbe96 (patch)
treef79fc09f414f9873d9a985e380b6384c24d00315 /source3/lib
parent0c0054fe1615a504d103da94149d1c1729abb8e2 (diff)
downloadsamba-7faee02d0d351c5c039e8f1be7e82ce3a93cbe96.tar.gz
samba-7faee02d0d351c5c039e8f1be7e82ce3a93cbe96.tar.bz2
samba-7faee02d0d351c5c039e8f1be7e82ce3a93cbe96.zip
Remove the char[1024] strings from dynconfig. Replace
them with malloc'ing accessor functions. Should save a lot of static space :-). Jeremy. (This used to be commit 52dc5eaef2106015b3a8b659e818bdb15ad94b05)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/fault.c2
-rw-r--r--source3/lib/ldb/common/ldb_modules.c2
-rw-r--r--source3/lib/pidfile.c8
-rw-r--r--source3/lib/popt_common.c26
-rw-r--r--source3/lib/util.c10
5 files changed, 24 insertions, 24 deletions
diff --git a/source3/lib/fault.c b/source3/lib/fault.c
index b5d290a2c8..33e1401d7a 100644
--- a/source3/lib/fault.c
+++ b/source3/lib/fault.c
@@ -108,7 +108,7 @@ void dump_core_setup(const char *progname)
* line by the -l option but the "log file" option is not set
* in smb.conf.
*/
- if (asprintf(&logbase, "%s", dyn_LOGFILEBASE) < 0) {
+ if (asprintf(&logbase, "%s", get_dyn_LOGFILEBASE()) < 0) {
return;
}
}
diff --git a/source3/lib/ldb/common/ldb_modules.c b/source3/lib/ldb/common/ldb_modules.c
index c2fec2aea8..68c4535e4d 100644
--- a/source3/lib/ldb/common/ldb_modules.c
+++ b/source3/lib/ldb/common/ldb_modules.c
@@ -212,7 +212,7 @@ int ldb_try_load_dso(struct ldb_context *ldb, const char *name)
modulesdir = talloc_strdup(ldb, getenv("LD_LDB_MODULE_PATH"));
} else {
#ifdef _SAMBA_BUILD_
- modulesdir = talloc_asprintf(ldb, "%s/ldb", dyn_MODULESDIR);
+ modulesdir = talloc_asprintf(ldb, "%s/ldb", get_dyn_LIBDIR());
#else
modulesdir = talloc_strdup(ldb, MODULESDIR);
#endif
diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c
index b6a8e02b49..f49f8afbb6 100644
--- a/source3/lib/pidfile.c
+++ b/source3/lib/pidfile.c
@@ -86,20 +86,20 @@ void pidfile_create(const char *program_name)
{
int fd;
char buf[20];
- char *short_configfile;
+ const char *short_configfile;
char *name;
char *pidFile;
pid_t pid;
/* Add a suffix to the program name if this is a process with a
* none default configuration file name. */
- if (strcmp( CONFIGFILE, dyn_CONFIGFILE) == 0) {
+ if (strcmp( CONFIGFILE, get_dyn_CONFIGFILE()) == 0) {
name = SMB_STRDUP(program_name);
} else {
- short_configfile = strrchr( dyn_CONFIGFILE, '/');
+ short_configfile = strrchr( get_dyn_CONFIGFILE(), '/');
if (short_configfile == NULL) {
/* conf file in current directory */
- short_configfile = dyn_CONFIGFILE;
+ short_configfile = get_dyn_CONFIGFILE();
} else {
/* full/relative path provided */
short_configfile++;
diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c
index 835eeaecc3..bc67a0fa28 100644
--- a/source3/lib/popt_common.c
+++ b/source3/lib/popt_common.c
@@ -66,7 +66,7 @@ static void popt_common_callback(poptContext con,
{
if (reason == POPT_CALLBACK_REASON_PRE) {
- set_logfile(con, dyn_LOGFILEBASE);
+ set_logfile(con, get_dyn_LOGFILEBASE());
return;
}
@@ -98,7 +98,7 @@ static void popt_common_callback(poptContext con,
case 's':
if (arg) {
- strlcpy(dyn_CONFIGFILE, arg,sizeof(dyn_CONFIGFILE));
+ set_dyn_CONFIGFILE(arg);
}
break;
@@ -112,7 +112,7 @@ static void popt_common_callback(poptContext con,
if (arg) {
set_logfile(con, arg);
override_logfile = True;
- snprintf(dyn_LOGFILEBASE, sizeof(dyn_LOGFILEBASE), "%s", arg);
+ set_dyn_LOGFILEBASE(arg);
}
break;
@@ -193,61 +193,61 @@ static void popt_dynconfig_callback(poptContext con,
switch (opt->val) {
case DYN_SBINDIR:
if (arg) {
- dyn_SBINDIR = SMB_STRDUP(arg);
+ set_dyn_SBINDIR(arg);
}
break;
case DYN_BINDIR:
if (arg) {
- dyn_BINDIR = SMB_STRDUP(arg);
+ set_dyn_BINDIR(arg);
}
break;
case DYN_SWATDIR:
if (arg) {
- dyn_SWATDIR = SMB_STRDUP(arg);
+ set_dyn_SWATDIR(arg);
}
break;
case DYN_LMHOSTSFILE:
if (arg) {
- strlcpy(dyn_LMHOSTSFILE, arg,sizeof(dyn_LMHOSTSFILE));
+ set_dyn_LMHOSTSFILE(arg);
}
break;
case DYN_LIBDIR:
if (arg) {
- strlcpy(dyn_LIBDIR, arg,sizeof(dyn_LIBDIR));
+ set_dyn_LIBDIR(arg);
}
break;
case DYN_SHLIBEXT:
if (arg) {
- fstrcpy(dyn_SHLIBEXT, arg);
+ set_dyn_SHLIBEXT(arg);
}
break;
case DYN_LOCKDIR:
if (arg) {
- strlcpy(dyn_LOCKDIR, arg,sizeof(dyn_LOCKDIR));
+ set_dyn_LOCKDIR(arg);
}
break;
case DYN_PIDDIR:
if (arg) {
- strlcpy(dyn_PIDDIR, arg,sizeof(dyn_PIDDIR));
+ set_dyn_PIDDIR(arg);
}
break;
case DYN_SMB_PASSWD_FILE:
if (arg) {
- strlcpy(dyn_SMB_PASSWD_FILE, arg,sizeof(dyn_SMB_PASSWD_FILE));
+ set_dyn_SMB_PASSWD_FILE(arg);
}
break;
case DYN_PRIVATE_DIR:
if (arg) {
- strlcpy(dyn_PRIVATE_DIR, arg, sizeof(dyn_PRIVATE_DIR));
+ set_dyn_PRIVATE_DIR(arg);
}
break;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 83b122c660..19c3e0c65b 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2569,7 +2569,7 @@ char *pid_path(const char *name)
char *lib_path(const char *name)
{
- return talloc_asprintf(talloc_tos(), "%s/%s", dyn_LIBDIR, name);
+ return talloc_asprintf(talloc_tos(), "%s/%s", get_dyn_LIBDIR(), name);
}
/**
@@ -2582,7 +2582,7 @@ char *lib_path(const char *name)
char *data_path(const char *name)
{
- return talloc_asprintf(talloc_tos(), "%s/%s", dyn_CODEPAGEDIR, name);
+ return talloc_asprintf(talloc_tos(), "%s/%s", get_dyn_CODEPAGEDIR(), name);
}
/*****************************************************************
@@ -2591,18 +2591,18 @@ a useful function for returning a path in the Samba state directory
char *state_path(const char *name)
{
- return xx_path(name, dyn_STATEDIR());
+ return xx_path(name, get_dyn_STATEDIR());
}
/**
* @brief Returns the platform specific shared library extension.
*
- * @retval Pointer to a static #fstring containing the extension.
+ * @retval Pointer to a const char * containing the extension.
**/
const char *shlib_ext(void)
{
- return dyn_SHLIBEXT;
+ return get_dyn_SHLIBEXT();
}
/*******************************************************************