aboutsummaryrefslogtreecommitdiff
path: root/lib/common/perror.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-22 14:18:13 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-22 14:18:13 +0100
commita807a45ffd64db60dc69012bef2538eaac3dac0b (patch)
tree818b73062c8684f9b96fca49d7d6d477c450fc22 /lib/common/perror.c
parent0b1fce762dca88659b3103783e8852cb7265823e (diff)
Make hard link detection scale better
Instead of doing a linear search, which scales quadratically, use a red-black tree with inode numbers as key for finding hard links. To reiterate: we can't just use a flat table, because the SquashFS file is potentially untrusted and the inode numbers can be anything, no matter what the super block says. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/common/perror.c')
-rw-r--r--lib/common/perror.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/common/perror.c b/lib/common/perror.c
index c7dab08..53a8c16 100644
--- a/lib/common/perror.c
+++ b/lib/common/perror.c
@@ -69,5 +69,11 @@ void sqfs_perror(const char *file, const char *action, int error_code)
break;
}
- fprintf(stderr, "%s: %s: %s.\n", file, action, errstr);
+ if (file != NULL)
+ fprintf(stderr, "%s: ", file);
+
+ if (action != NULL)
+ fprintf(stderr, "%s: ", action);
+
+ fprintf(stderr, "%s.\n", errstr);
}