]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
torture3: Simplify the g_lock6 test
authorVolker Lendecke <vl@samba.org>
Tue, 14 Aug 2018 11:52:11 +0000 (13:52 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 17 Aug 2018 05:39:16 +0000 (07:39 +0200)
Do string_term_tdb_data just once, this is a leftover from a sweeping
change from "char *" to TDB_DATA as g_lock key.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13195
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/torture/test_g_lock.c

index 43e699fb173535a2f4b41445667a48010311c722..ed1cd180f549e7af4408201895d9afc257f26e83 100644 (file)
@@ -730,7 +730,7 @@ bool run_g_lock6(int dummy)
        struct tevent_context *ev = NULL;
        struct messaging_context *msg = NULL;
        struct g_lock_ctx *ctx = NULL;
-       const char *lockname = "lock6";
+       TDB_DATA lockname = string_term_tdb_data("lock6");
        pid_t child;
        int exit_pipe[2], ready_pipe[2];
        NTSTATUS status;
@@ -780,7 +780,7 @@ bool run_g_lock6(int dummy)
                                exit(1);
                        }
                        status = g_lock_lock(ctx,
-                                            string_term_tdb_data(lockname),
+                                            lockname,
                                             G_LOCK_READ,
                                             (struct timeval) { .tv_sec = 1 });
                        if (!NT_STATUS_IS_OK(status)) {
@@ -824,8 +824,7 @@ bool run_g_lock6(int dummy)
        {
                struct lock6_parser_state state;
 
-               status = g_lock_dump(ctx, string_term_tdb_data(lockname),
-                                    lock6_parser, &state);
+               status = g_lock_dump(ctx, lockname, lock6_parser, &state);
                if (!NT_STATUS_IS_OK(status)) {
                        fprintf(stderr, "g_lock_dump returned %s\n",
                                nt_errstr(status));
@@ -838,7 +837,8 @@ bool run_g_lock6(int dummy)
                        return false;
                }
 
-               status = g_lock_lock(ctx, string_term_tdb_data(lockname),
+               status = g_lock_lock(ctx,
+                                    lockname,
                                     G_LOCK_WRITE,
                                     (struct timeval) { .tv_sec = 1 });
                if (!NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {