Make 'add_dir_entry()' consistent and allocate name for all types,
not only for 'd' and 's'. Also, since 'add_dir_entry()' sets the
parent - do not do this in the calling functions.
This is a clean-up which makes 'add_dir_entry()' more consistent.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
if (entry->type == 'f') {
struct file_info *file = target;
+ file->name = dup_string(name);
entry->file = file;
entry->next_link = file->links;
if (file->links)
free(path);
dir = zalloc(sizeof(struct dir_info));
- dir->parent = parent;
if (parent)
add_dir_entry(parent, 'd', name, dir);
return 0;
free(path);
file = zalloc(sizeof(struct file_info));
- file->name = dup_string(name);
-
add_dir_entry(parent, 'f', name, file);
add_fd(file, fd);
return 0;