1
0
Fork 0
mirror of https://github.com/pygos/pkg-utils.git synced 2024-05-20 21:26:14 +02:00

Improve unpack error handling, ignore mkdir failure on EEXIST

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-02-03 16:18:34 +01:00
parent dd6022b686
commit 8754729cb1

View file

@ -16,7 +16,10 @@ static int create_hierarchy(int dirfd, image_entry_t *list)
for (ent = list; ent != NULL; ent = ent->next) {
if (S_ISDIR(ent->mode)) {
if (mkdirat(dirfd, ent->name, 0755)) {
perror(ent->name);
if (errno == EEXIST)
continue;
fprintf(stderr, "mkdir %s: %s\n", ent->name,
strerror(errno));
return -1;
}
}
@ -26,7 +29,9 @@ static int create_hierarchy(int dirfd, image_entry_t *list)
if (S_ISLNK(ent->mode)) {
if (symlinkat(ent->data.symlink.target,
dirfd, ent->name)) {
perror(ent->name);
fprintf(stderr, "symlink %s to %s: %s\n",
ent->name, ent->data.symlink.target,
strerror(errno));
return -1;
}
}