mirror of
https://github.com/pygos/pkg-utils.git
synced 2024-11-06 05:37:10 +01:00
27 lines
446 B
C
27 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;
|
||
|
}
|