From b0ed8c9a3ee74ff2ab428beaf42819d1d0974215 Mon Sep 17 00:00:00 2001
From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Date: Thu, 25 Jul 2019 23:17:03 +0200
Subject: Add assertion around canonicalize_name in rdsquashfs

The names generated by fstree are always in the correct format, but this
is still needed for the sake of documentation and to guide static
analysis tools.

Should canonicalize_name fail on an fstree generated name, something is
serverly broken.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
---
 unpack/rdsquashfs.h     | 1 +
 unpack/restore_fstree.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/unpack/rdsquashfs.h b/unpack/rdsquashfs.h
index 8866679..56250fd 100644
--- a/unpack/rdsquashfs.h
+++ b/unpack/rdsquashfs.h
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/unpack/restore_fstree.c b/unpack/restore_fstree.c
index 5027625..a868062 100644
--- a/unpack/restore_fstree.c
+++ b/unpack/restore_fstree.c
@@ -77,7 +77,7 @@ static int create_node(tree_node_t *n, int flags)
 			return -1;
 		}
 
-		canonicalize_name(n->data.file->input_file);
+		assert(canonicalize_name(n->data.file->input_file) == 0);
 		break;
 	default:
 		break;
-- 
cgit v1.2.3