aboutsummaryrefslogtreecommitdiff
path: root/bin/sqfsdiff/util.c
blob: a11770f4900c50b562cf2b81099f18163636c288 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
}