summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-09-12 07:29:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:06:41 -0500
commitab309ada8ba2e4ef867f7fdb13012d09cb8d05c9 (patch)
treecb92b5f9fdbc86388f78d5543c9f3012f9788848 /source4
parent2e6f0016d12000d7b8d8f5094d66e65ef618045b (diff)
downloadsamba-ab309ada8ba2e4ef867f7fdb13012d09cb8d05c9.tar.gz
samba-ab309ada8ba2e4ef867f7fdb13012d09cb8d05c9.tar.bz2
samba-ab309ada8ba2e4ef867f7fdb13012d09cb8d05c9.zip
r25112: make torture_temp_dir() available via tortore/torture.h
and return more detailed errors metze (This used to be commit c2b645c8763fd75a0a81983ec44a5990670c4fc4)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/registry/tests/hive.c3
-rw-r--r--source4/lib/registry/tests/registry.c3
-rw-r--r--source4/torture/ui.c19
-rw-r--r--source4/torture/util.c16
4 files changed, 19 insertions, 22 deletions
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c
index a71e31474c..dff6d1e829 100644
--- a/source4/lib/registry/tests/hive.c
+++ b/source4/lib/registry/tests/hive.c
@@ -27,9 +27,6 @@
#include "librpc/gen_ndr/winreg.h"
#include "system/filesys.h"
-NTSTATUS torture_temp_dir(struct torture_context *tctx, const char *prefix,
- const char **tempdir);
-
static bool test_del_nonexistant_key(struct torture_context *tctx,
const void *test_data)
{
diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c
index 9809a6d4c8..962c7fd2b5 100644
--- a/source4/lib/registry/tests/registry.c
+++ b/source4/lib/registry/tests/registry.c
@@ -28,9 +28,6 @@
#include "libcli/security/security.h"
#include "system/filesys.h"
-NTSTATUS torture_temp_dir(struct torture_context *tctx, const char *prefix,
- const char **tempdir);
-
/**
* Test obtaining a predefined key.
*/
diff --git a/source4/torture/ui.c b/source4/torture/ui.c
index bb28803216..75d8a26dac 100644
--- a/source4/torture/ui.c
+++ b/source4/torture/ui.c
@@ -24,6 +24,25 @@
#include "lib/util/dlinklist.h"
#include "param/param.h"
+/**
+ create a temporary directory.
+*/
+_PUBLIC_ NTSTATUS torture_temp_dir(struct torture_context *tctx,
+ const char *prefix,
+ char **tempdir)
+{
+ SMB_ASSERT(tctx->outputdir != NULL);
+
+ *tempdir = talloc_asprintf(tctx, "%s/%s.XXXXXX", tctx->outputdir, prefix);
+ NT_STATUS_HAVE_NO_MEMORY(*tempdir);
+
+ if (mkdtemp(*tempdir) == NULL) {
+ return map_nt_error_from_unix(errno);
+ }
+
+ return NT_STATUS_OK;
+}
+
void torture_comment(struct torture_context *context, const char *comment, ...)
{
va_list ap;
diff --git a/source4/torture/util.c b/source4/torture/util.c
index b8bfa5f51f..713004d8d2 100644
--- a/source4/torture/util.c
+++ b/source4/torture/util.c
@@ -25,22 +25,6 @@
#include "libcli/raw/libcliraw.h"
/**
- create a temporary directory.
-*/
-_PUBLIC_ NTSTATUS torture_temp_dir(struct torture_context *tctx,
- const char *prefix,
- char **tempdir)
-{
- SMB_ASSERT(tctx->outputdir != NULL);
- *tempdir = talloc_asprintf(tctx, "%s/%s.XXXXXX", tctx->outputdir, prefix);
-
- if (mkdtemp(*tempdir) == NULL)
- return NT_STATUS_UNSUCCESSFUL;
-
- return NT_STATUS_OK;
-}
-
-/**
check if 2 NTTIMEs are equal.
*/
BOOL nt_time_equal(NTTIME *t1, NTTIME *t2)