r25112: make torture_temp_dir() available via tortore/torture.h
authorStefan Metzmacher <metze@samba.org>
Wed, 12 Sep 2007 07:29:29 +0000 (07:29 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:06:41 +0000 (15:06 -0500)
and return more detailed errors

metze
(This used to be commit c2b645c8763fd75a0a81983ec44a5990670c4fc4)

source4/lib/registry/tests/hive.c
source4/lib/registry/tests/registry.c
source4/torture/ui.c
source4/torture/util.c

index a71e31474c61a49d01293b5f7a53e65df802c946..dff6d1e8298aed84c073dab50299168ff343d526 100644 (file)
@@ -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)
 {
index 9809a6d4c8dd8e6b766b6009205555239ce8063c..962c7fd2b5137d362b0babe07c868366a390d254 100644 (file)
@@ -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.
  */
index bb28803216686857a37f9be17026c1c61b800841..75d8a26dac0d1d3c8dcd6a8441e8d28c16eebf4d 100644 (file)
 #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;
index b8bfa5f51f20c60ca1a9030b945968256c76d8c9..713004d8d2bacfc18f9f2194130e9acdeb936b08 100644 (file)
 #include "libcli/raw/interfaces.h"
 #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.
 */