aboutsummaryrefslogtreecommitdiff
path: root/bin/gensquashfs/src
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-21 21:11:18 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-21 21:11:18 +0200
commitb826045d0427db2c18eedda7e02f21acfc2ce62e (patch)
tree94af915f779ecb5c660159349f6bb4b2d423043b /bin/gensquashfs/src
parent6c7d1c6e6cb3187218fa180fc87919255928b999 (diff)
libutil: unix: simplify/unify directory iterator error handling
Instead of printing out error messages, return an errro ID and match the behavior with the Windows implementation. Also, don't check first if the struct stat says it is a link, the readlinkat() system call will fail if it isn't. Avoid confusing the deputy. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/gensquashfs/src')
-rw-r--r--bin/gensquashfs/src/fstree_from_dir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/gensquashfs/src/fstree_from_dir.c b/bin/gensquashfs/src/fstree_from_dir.c
index 85381f9..6200ea3 100644
--- a/bin/gensquashfs/src/fstree_from_dir.c
+++ b/bin/gensquashfs/src/fstree_from_dir.c
@@ -80,8 +80,10 @@ static int scan_dir(fstree_t *fs, tree_node_t *root, dir_iterator_t *dir,
int ret = dir->next(dir, &ent);
if (ret > 0)
break;
- if (ret < 0)
+ if (ret < 0) {
+ sqfs_perror("readdir", NULL, ret);
return -1;
+ }
if (should_skip(dir, ent, flags)) {
free(ent);
@@ -89,8 +91,10 @@ static int scan_dir(fstree_t *fs, tree_node_t *root, dir_iterator_t *dir,
}
if (S_ISLNK(ent->mode)) {
- if (dir->read_link(dir, &extra)) {
+ ret = dir->read_link(dir, &extra);
+ if (ret) {
free(ent);
+ sqfs_perror("readlink", ent->name, ret);
return -1;
}
}