aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-25 23:17:03 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-25 23:22:50 +0200
commitb0ed8c9a3ee74ff2ab428beaf42819d1d0974215 (patch)
treee8649e6e734227f12e2bfaa3b8d069b346960a50
parentf53a5948234fa7e4c11c38ee0a0b5ec43a5a7447 (diff)
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>
-rw-r--r--unpack/rdsquashfs.h1
-rw-r--r--unpack/restore_fstree.c2
2 files changed, 2 insertions, 1 deletions
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;