From 07c316a2bbf0ad0f41229ca668def609a5f50f2c Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 3 Oct 2020 02:34:23 -0500 Subject: Return empty string for dirtree_path() of "" (instead of NULL). --- lib/dirtree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/dirtree.c b/lib/dirtree.c index 9712ee14..37581829 100644 --- a/lib/dirtree.c +++ b/lib/dirtree.c @@ -90,7 +90,7 @@ char *dirtree_path(struct dirtree *node, int *plen) ll = len = plen ? *plen : 0; for (nn = node; nn; nn = nn->parent) if (*nn->name) len += strlen(nn->name)+1; if (plen) *plen = len; - if (!len) return 0; + if (!len) return xstrdup(""); path = xmalloc(len)+len-ll; for (nn = node; nn; nn = nn->parent) if ((len = strlen(nn->name))) { *--path = '/'*(nn != node); -- cgit v1.2.3