Merge branch 'master' of ssh://git.samba.org/data/git/samba
[tprouty/samba.git] / source3 / torture / utable.c
index 1d06194e46d59ba4d6bcec1860f317ec8cd494bc..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/>.
 */
 
 #include "includes.h"
 
-BOOL torture_utable(int dummy)
+bool torture_utable(int dummy)
 {
        struct cli_state *cli;
        fstring fname, alt_name;
@@ -32,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;
        }
 
@@ -47,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;
@@ -85,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");
 
@@ -104,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;
@@ -121,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;
        }