1
0
Fork 0
mirror of https://github.com/pygos/pkg-utils.git synced 2024-11-06 05:37:10 +01:00
pkg-utils/main/cmd/unpack/create_hierarchy.c
David Oberhollenzer 6ec11b532e Initial commit
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2019-01-26 23:19:21 +01:00

26 lines
446 B
C

#include "unpack.h"
int create_hierarchy(image_entry_t *list)
{
image_entry_t *ent;
for (ent = list; ent != NULL; ent = ent->next) {
if (S_ISDIR(ent->mode)) {
if (mkdir(ent->name, 0755)) {
perror(ent->name);
return -1;
}
}
}
for (ent = list; ent != NULL; ent = ent->next) {
if (S_ISLNK(ent->mode)) {
if (symlink(ent->data.symlink.target, ent->name)) {
perror(ent->name);
return -1;
}
}
}
return 0;
}