RIP BOOL. Convert BOOL -> bool. I found a few interesting
[jerry/samba.git] / source / torture / locktest.c
index 7a970488b37fbaaebec931f4ecd63f8be27a7064..20fd49b3e1010e898495cd8d11bbbafc732b842c 100644 (file)
@@ -5,7 +5,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -24,17 +23,17 @@ static fstring password[2];
 static fstring username[2];
 static int got_user;
 static int got_pass;
-static BOOL use_kerberos;
+static bool use_kerberos;
 static int numops = 1000;
-static BOOL showall;
-static BOOL analyze;
-static BOOL hide_unlock_fails;
-static BOOL use_oplocks;
+static bool showall;
+static bool analyze;
+static bool hide_unlock_fails;
+static bool use_oplocks;
 static unsigned lock_range = 100;
 static unsigned lock_base = 0;
 static unsigned min_length = 0;
-static BOOL exact_error_codes;
-static BOOL zero_zero;
+static bool exact_error_codes;
+static bool zero_zero;
 
 extern char *optarg;
 extern int optind;
@@ -139,7 +138,7 @@ static void print_brl(struct file_id id,
 #endif
 
        printf("%s   %s    %s  %.0f:%.0f(%.0f)\n", 
-              procid_str_static(&pid), file_id_static_string(&id),
+              procid_str_static(&pid), file_id_string_tos(&id),
               lock_type==READ_LOCK?"R":"W",
               (double)start, (double)start+size-1,(double)size);
 
@@ -165,6 +164,7 @@ static struct cli_state *connect_one(char *share, int snum)
        struct in_addr ip;
        fstring myname;
        static int count;
+       NTSTATUS status;
 
        fstrcpy(server,share+2);
        share = strchr_m(server,'\\');
@@ -174,7 +174,7 @@ static struct cli_state *connect_one(char *share, int snum)
 
        server_n = server;
        
-        zero_ip(&ip);
+        zero_ip_v4(&ip);
 
        slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++);
 
@@ -182,14 +182,20 @@ static struct cli_state *connect_one(char *share, int snum)
        make_nmb_name(&called , server, 0x20);
 
  again:
-        zero_ip(&ip);
+        zero_ip_v4(&ip);
 
        /* have to open a new connection */
-       if (!(c=cli_initialise()) || !cli_connect(c, server_n, &ip)) {
+       if (!(c=cli_initialise())) {
                DEBUG(0,("Connection to %s failed\n", server_n));
                return NULL;
        }
 
+       status = cli_connect(c, server_n, &ip);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0,("Connection to %s failed. Error %s\n", server_n, nt_errstr(status) ));
+               return NULL;
+       }
+
        c->use_kerberos = use_kerberos;
 
        if (!cli_session_request(c, &calling, &called)) {
@@ -289,7 +295,7 @@ static void reconnect(struct cli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NS
 
 
 
-static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
+static bool test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS], 
                     int fnum[NSERVERS][NCONNECTIONS][NFILES],
                     struct record *rec)
 {
@@ -299,7 +305,7 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
        SMB_BIG_UINT len = rec->len;
        enum brl_type op = rec->lock_type;
        int server;
-       BOOL ret[NSERVERS];
+       bool ret[NSERVERS];
        NTSTATUS status[NSERVERS];
 
        switch (rec->lock_op) {