diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:30 +0000 |
commit | c61e14d3a8412cd50d98aab604e607692c844c8a (patch) | |
tree | 4925aca0e6b64c8664ea2f3fdfa99a52dc93d5da /libfdisk/src/script.c | |
parent | Adding upstream version 2.39.3. (diff) | |
download | util-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.tar.xz util-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.zip |
Adding upstream version 2.40.upstream/2.40
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libfdisk/src/script.c')
-rw-r--r-- | libfdisk/src/script.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c index f537a7d..e357fad 100644 --- a/libfdisk/src/script.c +++ b/libfdisk/src/script.c @@ -1108,7 +1108,7 @@ static int parse_size_value(struct fdisk_script *dp, struct fdisk_partition *pa, done: DBG(SCRIPT, ul_debugobj(dp, " size parse result: rc=%d, move=%s, size=%ju, default=%s", rc, pa->resize == FDISK_RESIZE_REDUCE ? "reduce" : - pa->resize == FDISK_RESIZE_ENLARGE ? "enlage" : "none", + pa->resize == FDISK_RESIZE_ENLARGE ? "enlarge" : "none", pa->size, pa->end_follow_default ? "on" : "off")); return rc; @@ -1669,8 +1669,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) #endif #ifdef TEST_PROGRAM -static int test_dump(struct fdisk_test *ts, int argc, char *argv[]) +static int test_dump(struct fdisk_test *ts __attribute__((unused)), + int argc, char *argv[]) { + if (argc != 2) + return -1; + char *devname = argv[1]; struct fdisk_context *cxt; struct fdisk_script *dp; @@ -1688,8 +1692,12 @@ static int test_dump(struct fdisk_test *ts, int argc, char *argv[]) return 0; } -static int test_read(struct fdisk_test *ts, int argc, char *argv[]) +static int test_read(struct fdisk_test *ts __attribute__((unused)), + int argc, char *argv[]) { + if (argc != 2) + return -1; + char *filename = argv[1]; struct fdisk_script *dp; struct fdisk_context *cxt; @@ -1711,8 +1719,12 @@ static int test_read(struct fdisk_test *ts, int argc, char *argv[]) return 0; } -static int test_stdin(struct fdisk_test *ts, int argc, char *argv[]) +static int test_stdin(struct fdisk_test *ts __attribute__((unused)), + int argc, char *argv[] __attribute__((unused))) { + if (argc != 1) + return -1; + char buf[BUFSIZ] = { '\0' }; struct fdisk_script *dp; struct fdisk_context *cxt; @@ -1746,8 +1758,12 @@ static int test_stdin(struct fdisk_test *ts, int argc, char *argv[]) return rc; } -static int test_apply(struct fdisk_test *ts, int argc, char *argv[]) +static int test_apply(struct fdisk_test *ts __attribute__((unused)), + int argc, char *argv[]) { + if (argc != 3) + return -1; + char *devname = argv[1], *scriptname = argv[2]; struct fdisk_context *cxt; struct fdisk_script *dp; @@ -1788,8 +1804,12 @@ done: return 0; } -static int test_tokens(struct fdisk_test *ts, int argc, char *argv[]) +static int test_tokens(struct fdisk_test *ts __attribute__((unused)), + int argc, char *argv[]) { + if (argc != 2) + return -1; + char *p, *str = argc == 2 ? strdup(argv[1]) : NULL; int i; |