summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2007-12-16 00:03:56 +0100
committerVolker Lendecke <vl@samba.org>2007-12-16 14:02:26 +0100
commitdd4e99c9d7111fe1fab9b0a968c1321425f83429 (patch)
tree4c76cfb7401d8f8216f238ec6907debb94928f2a
parent02dd1f7f4c4f6e1f91bd651ccdde9b2bb3fcef81 (diff)
downloadsamba-dd4e99c9d7111fe1fab9b0a968c1321425f83429.tar.gz
samba-dd4e99c9d7111fe1fab9b0a968c1321425f83429.tar.bz2
samba-dd4e99c9d7111fe1fab9b0a968c1321425f83429.zip
Remove a static fstring
(This used to be commit a9c62c57db9e580640d0265b08b3178496de76a8)
-rw-r--r--source3/lib/version.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/source3/lib/version.c b/source3/lib/version.c
index ca334a27d9..204c2044a8 100644
--- a/source3/lib/version.c
+++ b/source3/lib/version.c
@@ -19,33 +19,41 @@
*/
#include "includes.h"
+#include <assert.h>
const char *samba_version_string(void)
{
#ifndef SAMBA_VERSION_VENDOR_SUFFIX
return SAMBA_VERSION_OFFICIAL_STRING;
#else
- static fstring samba_version;
- static bool init_samba_version;
+ static char *samba_version;
+ int res;
#ifdef SAMBA_VERSION_VENDOR_PATCH
- fstring tmp_version;
- size_t remaining;
+ char *tmp_version;
#endif
- if (init_samba_version)
+ if (samba_version != NULL)
return samba_version;
- snprintf(samba_version,sizeof(samba_version),"%s-%s",
- SAMBA_VERSION_OFFICIAL_STRING,
- SAMBA_VERSION_VENDOR_SUFFIX);
+ res = asprintf(&samba_version, "%s-%s",
+ SAMBA_VERSION_OFFICIAL_STRING,
+ SAMBA_VERSION_VENDOR_SUFFIX);
+ /*
+ * Can't use smb_panic here due to dependencies
+ */
+ assert(res != -1);
#ifdef SAMBA_VERSION_VENDOR_PATCH
- remaining = sizeof(samba_version)-strlen(samba_version);
- snprintf( tmp_version, sizeof(tmp_version), "-%d", SAMBA_VERSION_VENDOR_PATCH );
- strlcat( samba_version, tmp_version, remaining-1 );
+ res = asprintf(&tmp_version, "%s-%d", samba_version,
+ SAMBA_VERSION_VENDOR_PATCH);
+ /*
+ * Can't use smb_panic here due to dependencies
+ */
+ assert(res != -1);
+
+ samba_version = tmp_version;
#endif
- init_samba_version = True;
return samba_version;
#endif
}