X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fnamespacize.c;h=cf6bc26d7c4983a8d3483c976ecb9428ad8ebaac;hp=77269aac317dac5a4d7c7b319aa794472739f116;hb=c6bbde3a1b508d6cbb417ee99d64e4fbd09c865c;hpb=747a69435d9f83c0968d9689c4951bc0233ffc5e diff --git a/tools/namespacize.c b/tools/namespacize.c index 77269aac..cf6bc26d 100644 --- a/tools/namespacize.c +++ b/tools/namespacize.c @@ -53,7 +53,8 @@ static char **get_dir(const char *dir) names[size++] = talloc_asprintf(names, "%s/%s", dir, ent->d_name); } - names[size++] = NULL; + /* FIXME: if the loop doesn't run at least once, we'll segfault here */ + names[size] = NULL; closedir(d); return names; } @@ -406,7 +407,7 @@ static void setup_adjust_files(const char *dir, static void rename_files(const struct adjusted *adj) { while (adj) { - if (rename(adj->tmpfile, adj->file) != 0) + if (!move_file(adj->tmpfile, adj->file)) warn("Could not rename over '%s', we're in trouble", adj->file); adj = adj->next; @@ -445,7 +446,7 @@ static struct replace *read_replacement_file(const char *depdir) return NULL; } - for (line = strsplit(file, file, "\n", NULL); *line; line++) + for (line = strsplit(file, file, "\n"); *line; line++) add_replace(&repl, *line); return repl; }