mirror of
https://github.com/pygos/pkg-utils.git
synced 2024-11-21 20:39:46 +01:00
Improve unpack error handling, ignore mkdir failure on EEXIST
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
parent
dd6022b686
commit
8754729cb1
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue