summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-02-09 10:28:08 -0800
committerJeremy Allison <jra@samba.org>2011-02-09 21:21:04 +0100
commit344e4cd2801805faf38b86f7f33b05e204452532 (patch)
treed26d9dee0775b5d4df21b51fb9e490c5f4118d03 /source3
parent8c363e9252cfaeb1a7d30870e3a0d44cb9d8a39b (diff)
downloadsamba-344e4cd2801805faf38b86f7f33b05e204452532.tar.gz
samba-344e4cd2801805faf38b86f7f33b05e204452532.tar.bz2
samba-344e4cd2801805faf38b86f7f33b05e204452532.zip
Don't use asprintf in this library - breaks the build on many systems. Fake with malloc/memcpy.
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/smb_share_modes.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index 3174500820..e752f618a4 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -267,15 +267,20 @@ static uint32_t smb_name_hash(const char *sharepath, const char *filename, int *
{
TDB_DATA key;
char *fullpath = NULL;
- int ret;
+ size_t sharepath_size = strlen(sharepath);
+ size_t filename_size = strlen(filename);
uint32_t name_hash;
*err = 0;
- ret = asprintf(&fullpath, "%s/%s", sharepath, filename);
- if (ret == -1) {
+ fullpath = malloc(sharepath_size + filename_size + 2);
+ if (fullpath == NULL) {
*err = 1;
return 0;
}
+ memcpy(fullpath, sharepath, sharepath_size);
+ fullpath[sharepath_size] = '/';
+ memcpy(&fullpath[sharepath_size + 1], filename, filename_size + 1);
+
key.dptr = (uint8_t *)fullpath;
key.dsize = strlen(fullpath) + 1;
name_hash = tdb_jenkins_hash(&key);