[PATCH 08/14] s4-torture: Use talloc for asprintf.
Andreas Schneider
asn at samba.org
Wed Dec 4 06:01:54 MST 2013
Signed-off-by: Andreas Schneider <asn at samba.org>
---
source4/torture/raw/setfileinfo.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c
index 95ce060..3d7acb8 100644
--- a/source4/torture/raw/setfileinfo.c
+++ b/source4/torture/raw/setfileinfo.c
@@ -36,7 +36,6 @@ torture_raw_sfileinfo_base(struct torture_context *torture, struct smbcli_state
bool ret = true;
int fnum = -1;
char *fnum_fname;
- char *fnum_fname_new;
char *path_fname;
char *path_fname_new;
union smb_fileinfo finfo1, finfo2;
@@ -47,10 +46,9 @@ torture_raw_sfileinfo_base(struct torture_context *torture, struct smbcli_state
bool check_fnum;
int n = time(NULL) % 100;
- asprintf(&path_fname, BASEDIR "\\fname_test_%d.txt", n);
- asprintf(&path_fname_new, BASEDIR "\\fname_test_new_%d.txt", n);
- asprintf(&fnum_fname, BASEDIR "\\fnum_test_%d.txt", n);
- asprintf(&fnum_fname_new, BASEDIR "\\fnum_test_new_%d.txt", n);
+ path_fname = talloc_asprintf(torture, BASEDIR "\\fname_test_%d.txt", n);
+ path_fname_new = talloc_asprintf(torture, BASEDIR "\\fname_test_new_%d.txt", n);
+ fnum_fname = talloc_asprintf(torture, BASEDIR "\\fnum_test_%d.txt", n);
torture_assert(torture, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);
@@ -481,13 +479,13 @@ torture_raw_sfileinfo_rename(struct torture_context *torture,
const char *call_name;
bool check_fnum;
int n = time(NULL) % 100;
-
- asprintf(&path_fname, BASEDIR "\\fname_test_%d.txt", n);
- asprintf(&path_fname_new, BASEDIR "\\fname_test_new_%d.txt", n);
- asprintf(&fnum_fname, BASEDIR "\\fnum_test_%d.txt", n);
- asprintf(&fnum_fname_new, BASEDIR "\\fnum_test_new_%d.txt", n);
- asprintf(&path_dname, BASEDIR "\\dname_test_%d", n);
- asprintf(&path_dname_new, BASEDIR "\\dname_test_new_%d", n);
+
+ path_fname = talloc_asprintf(torture, BASEDIR "\\fname_test_%d.txt", n);
+ path_fname_new = talloc_asprintf(torture, BASEDIR "\\fname_test_new_%d.txt", n);
+ fnum_fname = talloc_asprintf(torture, BASEDIR "\\fnum_test_%d.txt", n);
+ fnum_fname_new = talloc_asprintf(torture, "\\fnum_test_new_%d.txt", n);
+ path_dname = talloc_asprintf(torture, BASEDIR "\\dname_test_%d", n);
+ path_dname_new = talloc_asprintf(torture, BASEDIR "\\dname_test_new_%d", n);
torture_assert(torture, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR);
--
1.8.5
More information about the samba-technical
mailing list