Jerone Young
2005-Sep-21 18:57 UTC
[Xen-devel] [PATCH] fix xenstore check to properly compile with x86-64
This fixes the "make check" feature of xenstore to properly compile with x86-64. When compiling you would get the following error since on x86-64 it was passing a long , when you are expecting an int: (snippet) cc1: warnings being treated as errors xs_random.c: In function ‘init_perms’: xs_random.c:253: warning: field precision should have type ‘int’, but argument 3 has type ‘long int’ xs_random.c: In function ‘parent_filename’: xs_random.c:311: warning: field precision should have type ‘int’, but argument 3 has type ‘long int’) Signed-off-by: Jerone Young <jyoung5@us.ibm.com> --- tools/xenstore/xs_random.c.bak 2005-09-21 13:56:04.000000000 -0400 +++ tools/xenstore/xs_random.c 2005-09-21 13:52:31.000000000 -0400 @@ -75,7 +75,7 @@ static void maybe_convert_to_directory(c { struct stat st; char *dirname = talloc_asprintf(filename, "%.*s", - strrchr(filename, ''/'') - filename, + (int)(strrchr(filename, ''/'') - filename), filename); if (lstat(dirname, &st) == 0 && S_ISREG(st.st_mode)) convert_to_dir(dirname); @@ -249,7 +249,7 @@ static void init_perms(const char *filen /* Copy permissions from parent */ command = talloc_asprintf(filename, "cp %.*s/.perms %s", - strrchr(filename, ''/'') - filename, + (int)(strrchr(filename, ''/'') - filename), filename, permfile); do_command(command); } @@ -308,7 +308,7 @@ static char *parent_filename(const char char *slash = strrchr(name + 1, ''/''); if (!slash) return talloc_strdup(name, "/"); - return talloc_asprintf(name, "%.*s", slash-name, name); + return talloc_asprintf(name, "%.*s", (int)(slash-name), name); } static void make_dirs(const char *filename) @@ -1063,7 +1063,7 @@ static unsigned int try_simple(const boo ret = do_next_op(data->ops, h, i + data->seed, verbose); if (verbose) - printf("-> %.*s\n", strchr(ret, ''\n'') - ret, ret); + printf("-> %.*s\n", (int)(strchr(ret, ''\n'') - ret), ret); if (streq(ret, "FAILED:Bad file descriptor")) goto out; if (kill(daemon_pid, 0) != 0) @@ -1334,13 +1334,13 @@ static unsigned int try_diff(const bool file = do_next_op(&file_ops, fileh, i+data->seed, verbose); if (verbose) - printf("-> %.*s\n", strchr(file, ''/'') - file, file); + printf("-> %.*s\n", (int)(strchr(file, ''/'') - file), file); if (verbose) printf("XS: "); xs = do_next_op(&xs_ops, xsh, i+data->seed, verbose); if (verbose) - printf("-> %.*s\n", strchr(xs, ''/'') - xs, xs); + printf("-> %.*s\n", (int)(strchr(xs, ''/'') - xs), xs); if (!streq(file, xs)) goto out; @@ -1508,7 +1508,7 @@ static unsigned int try_fail(const bool aborted++; if (verbose) - printf("-> %.*s\n", strchr(ret, ''\n'') - ret, ret); + printf("-> %.*s\n", (int)(strchr(ret, ''\n'') - ret), ret); talloc_free(ret); -- Jerone Young IBM Linux Technology Center jyoung5@us.ibm.com 512-838-1157 (T/L: 678-1157) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel