smbtorture3: Avoid an "else"
authorVolker Lendecke <vl@samba.org>
Mon, 5 Sep 2022 11:08:54 +0000 (13:08 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 7 Sep 2022 18:40:28 +0000 (18:40 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/torture/torture.c

index 32ba9be5fb037d5af5453e732dcda3d820f573c0..8e496320dda8b68675513cf3cb1ff260f500e048 100644 (file)
@@ -7765,6 +7765,7 @@ static bool run_simple_posix_open_test(int dummy)
        size_t nread;
        const char *fname_windows = "windows_file";
        uint16_t fnum2 = (uint16_t)-1;
+       bool ok;
 
        printf("Starting simple POSIX open test\n");
 
@@ -8033,15 +8034,16 @@ static bool run_simple_posix_open_test(int dummy)
        if (NT_STATUS_IS_OK(status)) {
                printf("POSIX open of %s succeeded (should have failed)\n", sname);
                goto out;
-       } else {
-               if (!check_both_error(__LINE__, status, ERRDOS, ERRbadpath,
-                               NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
-                       printf("POSIX open of %s should have failed "
-                               "with NT_STATUS_OBJECT_NAME_NOT_FOUND, "
-                               "failed with %s instead.\n",
-                               sname, nt_errstr(status));
-                       goto out;
-               }
+       }
+       ok = check_both_error(
+               __LINE__, status, ERRDOS, ERRbadpath,
+               NT_STATUS_OBJECT_NAME_NOT_FOUND);
+       if (!ok) {
+               printf("POSIX open of %s should have failed "
+                      "with NT_STATUS_OBJECT_NAME_NOT_FOUND, "
+                      "failed with %s instead.\n",
+                      sname, nt_errstr(status));
+               goto out;
        }
 
        status = cli_posix_readlink(cli1, sname, talloc_tos(), &target);