summaryrefslogtreecommitdiff
path: root/tests/gensquashfs/fstree_fuzz.c
blob: 4fbb72b0180489dc2e495a728a21315cddddb6a0 (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
28
29
30
31
32
33
34
/* SPDX-License-Identifier: GPL-3.0-or-later */
/*
 * fstree_fuzz.c
 *
 * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
 */
#include "config.h"

#include "mkfs.h"

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv)
{
	int ret = EXIT_FAILURE;
	fstree_t fs;

	if (argc != 2) {
		fputs("Usage: fstree_fuzz <input_file>\n", stderr);
		return EXIT_FAILURE;
	}

	if (fstree_init(&fs, NULL))
		return EXIT_FAILURE;

	if (fstree_from_file(&fs, argv[1], NULL))
		goto out_fs;

	ret = EXIT_SUCCESS;
out_fs:
	fstree_cleanup(&fs);
	return ret;
}