aboutsummaryrefslogtreecommitdiff
path: root/bin/sqfsdiff/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sqfsdiff/src/util.c')
-rw-r--r--bin/sqfsdiff/src/util.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/sqfsdiff/src/util.c b/bin/sqfsdiff/src/util.c
new file mode 100644
index 0000000..a11770f
--- /dev/null
+++ b/bin/sqfsdiff/src/util.c
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * util.c
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#include "sqfsdiff.h"
+
+char *node_path(const sqfs_tree_node_t *n)
+{
+ char *path;
+ int ret;
+
+ ret = sqfs_tree_node_get_path(n, &path);
+ if (ret != 0) {
+ sqfs_perror(NULL, "get path", ret);
+ return NULL;
+ }
+
+ if (canonicalize_name(path)) {
+ fprintf(stderr, "failed to canonicalization '%s'\n", path);
+ sqfs_free(path);
+ return NULL;
+ }
+
+ return path;
+}