svn commit: samba r24897 - in branches/SAMBA_4_0: . source/torture
jelmer at samba.org
jelmer at samba.org
Sun Sep 2 16:12:50 GMT 2007
Author: jelmer
Date: 2007-09-02 16:12:49 +0000 (Sun, 02 Sep 2007)
New Revision: 24897
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24897
Log:
Do some sanity checking on --basedir.
Modified:
branches/SAMBA_4_0/
branches/SAMBA_4_0/source/torture/smbtorture.c
branches/SAMBA_4_0/source/torture/util.c
Changeset:
Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...
Modified: branches/SAMBA_4_0/source/torture/smbtorture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/smbtorture.c 2007-09-02 15:05:58 UTC (rev 24896)
+++ branches/SAMBA_4_0/source/torture/smbtorture.c 2007-09-02 16:12:49 UTC (rev 24897)
@@ -651,7 +651,20 @@
}
torture = torture_context_init(talloc_autofree_context(), ui_ops);
- torture->outputdir = basedir;
+ if (basedir != NULL) {
+ if (basedir[0] != '/') {
+ fprintf(stderr, "Please specify an absolute path to --basedir\n");
+ return 1;
+ }
+ torture->outputdir = basedir;
+ } else {
+ char *pwd = talloc_size(torture, PATH_MAX);
+ if (!getcwd(pwd, PATH_MAX)) {
+ fprintf(stderr, "Unable to determine current working directory\n");
+ return 1;
+ }
+ torture->outputdir = pwd;
+ }
if (argc_new == 0) {
printf("You must specify a test to run, or 'ALL'\n");
Modified: branches/SAMBA_4_0/source/torture/util.c
===================================================================
--- branches/SAMBA_4_0/source/torture/util.c 2007-09-02 15:05:58 UTC (rev 24896)
+++ branches/SAMBA_4_0/source/torture/util.c 2007-09-02 16:12:49 UTC (rev 24897)
@@ -28,9 +28,10 @@
create a temporary directory.
*/
_PUBLIC_ NTSTATUS torture_temp_dir(struct torture_context *tctx,
- const char *prefix,
- char **tempdir)
+ const char *prefix,
+ char **tempdir)
{
+ SMB_ASSERT(tctx->outputdir != NULL);
*tempdir = talloc_asprintf(tctx, "%s/%s.XXXXXX", tctx->outputdir, prefix);
if (mkdtemp(*tempdir) == NULL)
More information about the samba-cvs
mailing list