aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Kjellerstedt <pkj@axis.com>2020-11-21 17:22:38 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-12-16 16:48:56 +0000
commit2ae4513c340d9d284169921d6a160de4ef81d581 (patch)
tree48a3e4a78d34e19a04830ccbc853145d07cd1e7f
parent69f205c41902e17933b81b1450636848e8da2126 (diff)
downloadpseudo-2ae4513c340d9d284169921d6a160de4ef81d581.tar.gz
pseudo-2ae4513c340d9d284169921d6a160de4ef81d581.tar.bz2
pseudo-2ae4513c340d9d284169921d6a160de4ef81d581.zip
pseudo_client: Lessen indentation of pseudo_client_ignore_path_chroot()
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--pseudo_client.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/pseudo_client.c b/pseudo_client.c
index ea9d551..5549986 100644
--- a/pseudo_client.c
+++ b/pseudo_client.c
@@ -1527,28 +1527,33 @@ int pseudo_client_ignore_fd(int fd) {
int pseudo_client_ignore_path_chroot(const char *path, int ignore_chroot) {
char *env;
- if (path) {
- if (ignore_chroot && pseudo_chroot && strncmp(path, pseudo_chroot, pseudo_chroot_len) == 0)
- return 0;
- env = pseudo_get_value("PSEUDO_IGNORE_PATHS");
- if (env) {
- char *p = env;
- while (*p) {
- char *next = strchr(p, ',');
- if (!next)
- next = strchr(p, '\0');
- if ((next - p) && !strncmp(path, p, next - p)) {
- pseudo_debug(PDBGF_PATH | PDBGF_VERBOSE, "ignoring path: '%s'\n", path);
- return 1;
- }
- if (next && *next != '\0')
- p = next+1;
- else
- break;
- }
- free(env);
+
+ if (!path)
+ return 0;
+
+ if (ignore_chroot && pseudo_chroot && strncmp(path, pseudo_chroot, pseudo_chroot_len) == 0)
+ return 0;
+
+ env = pseudo_get_value("PSEUDO_IGNORE_PATHS");
+ if (!env)
+ return 0;
+
+ char *p = env;
+ while (*p) {
+ char *next = strchr(p, ',');
+ if (!next)
+ next = strchr(p, '\0');
+ if ((next - p) && !strncmp(path, p, next - p)) {
+ pseudo_debug(PDBGF_PATH | PDBGF_VERBOSE, "ignoring path: '%s'\n", path);
+ return 1;
}
+ if (next && *next != '\0')
+ p = next+1;
+ else
+ break;
}
+ free(env);
+
return 0;
}