[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-unstable-160-g8c73e19
Jeremy Allison
jra at samba.org
Fri Nov 2 16:27:33 GMT 2007
The branch, v3-2-test has been updated
via 8c73e19f51d6e3f520cf44dd22f9b9584d4b460f (commit)
from 84d22f7747126608b9460f9591bb5967d871b82d (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 8c73e19f51d6e3f520cf44dd22f9b9584d4b460f
Author: Jeremy Allison <jra at samba.org>
Date: Fri Nov 2 09:27:04 2007 -0700
Fix state_path to take a const string, not use pstring.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source/lib/util.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/lib/util.c b/source/lib/util.c
index c8f0c31..0ae80c1 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -550,7 +550,7 @@ int set_message(char *buf,int num_words,int num_bytes,bool zero)
int set_message_bcc(char *buf,int num_bytes)
{
int num_words = CVAL(buf,smb_wct);
- SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);
+ SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);
smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4);
return (smb_size + num_words*2 + num_bytes);
}
@@ -2450,21 +2450,25 @@ char *data_path(const char *name)
/*****************************************************************
a useful function for returning a path in the Samba state directory
*****************************************************************/
-char *state_path(char *name)
+
+char *state_path(const char *name)
{
- pstring fname;
+ TALLOC_CTX *ctx = talloc_tos();
+ char *fname = talloc_strdup(ctx, dyn_STATEDIR());
- pstrcpy(fname,dyn_STATEDIR());
+ if (!fname) {
+ smb_panic("state_path: out of memory");
+ }
trim_string(fname,"","/");
if (!directory_exist(fname,NULL)) {
mkdir(fname,0755);
}
- pstrcat(fname,"/");
- pstrcat(fname,name);
+ fname = talloc_asprintf(ctx, "%s/%s",
+ fname, name);
- return talloc_strdup(talloc_tos(), fname);
+ return fname;
}
/**
--
Samba Shared Repository
More information about the samba-cvs
mailing list