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;
}
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;
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;
}