s3-util: for convenience, provide format comments in tdb_unpack().
[jra/samba/.git] / source3 / torture / utable.c
index ba803a0da4fabf980387367e62b524e7ca8ab141..e36b0388c4ed42a1c1b80ff30a5d6ed13006ea9a 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,
    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/>.
 */
 
-#define NO_SYSLOG
-
 #include "includes.h"
 
-BOOL torture_utable(int dummy)
+bool torture_utable(int dummy)
 {
        struct cli_state *cli;
        fstring fname, alt_name;
@@ -34,7 +31,7 @@ BOOL torture_utable(int dummy)
 
        printf("starting utable\n");
 
-       if (!torture_open_connection(&cli)) {
+       if (!torture_open_connection(&cli, 0)) {
                return False;
        }
 
@@ -49,7 +46,7 @@ BOOL torture_utable(int dummy)
                SSVAL(&c2, 0, c);
                fstrcpy(fname, "\\utable\\x");
                p = fname+strlen(fname);
-               len = convert_string(CH_UCS2, CH_UNIX, 
+               len = convert_string(CH_UTF16LE, CH_UNIX, 
                                     &c2, 2, 
                                     p, sizeof(fname)-strlen(fname), True);
                p[len] = 0;
@@ -87,7 +84,11 @@ BOOL torture_utable(int dummy)
                d_printf("Failed to create valid.dat - %s", strerror(errno));
                return False;
        }
-       write(fd, valid, 0x10000);
+       if (write(fd, valid, 0x10000) != 0x10000) {
+               d_printf("Failed to create valid.dat - %s", strerror(errno));
+               close(fd);
+               return false;
+       }
        close(fd);
        d_printf("wrote valid.dat\n");
 
@@ -106,14 +107,14 @@ static char *form_name(int c)
        p = fname+strlen(fname);
        SSVAL(&c2, 0, c);
 
-       len = convert_string(CH_UCS2, CH_UNIX, 
+       len = convert_string(CH_UTF16LE, CH_UNIX, 
                             &c2, 2, 
                             p, sizeof(fname)-strlen(fname), True);
        p[len] = 0;
        return fname;
 }
 
-BOOL torture_casetable(int dummy)
+bool torture_casetable(int dummy)
 {
        static struct cli_state *cli;
        char *fname;
@@ -123,7 +124,7 @@ BOOL torture_casetable(int dummy)
        smb_ucs2_t equiv[0x10000][MAX_EQUIVALENCE];
        printf("starting casetable\n");
 
-       if (!torture_open_connection(&cli)) {
+       if (!torture_open_connection(&cli, 0)) {
                return False;
        }
 
@@ -137,7 +138,7 @@ BOOL torture_casetable(int dummy)
        }
 
        for (c=1; c < 0x10000; c++) {
-               size_t size;
+               SMB_OFF_T size;
 
                if (c == '.' || c == '\\') continue;