From 56e120f0c4099cc4dfc0ca1fba76270a8e36ec76 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 11 Dec 2023 16:29:39 +0100 Subject: [PATCH] iiod: Print error message when more parameters are needed If the network support has been disabled, we must have extra parameters to be able to use either the USB frontend, or the UART frontend. If no extra parameters corresponding to those frontends are passed, exit with an error message. Signed-off-by: Paul Cercueil --- iiod/iiod.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/iiod/iiod.c b/iiod/iiod.c index 755a5bb86..7b6bb6e48 100644 --- a/iiod/iiod.c +++ b/iiod/iiod.c @@ -289,6 +289,13 @@ static int start_iiod(const char *uri, const char *ffs_mountpoint, LIBIIO_VERSION_MAJOR, LIBIIO_VERSION_MINOR, LIBIIO_VERSION_GIT); + if (!WITH_IIOD_NETWORK + && (!WITH_IIOD_USBD || !ffs_mountpoint) + && (!WITH_IIOD_SERIAL || !uart_params)) { + IIO_ERROR("Not enough parameters given.\n"); + return EXIT_FAILURE; + } + ctx = iio_create_context(&iiod_params, uri); if (iio_err(ctx)) { IIO_PERROR(iio_err(ctx), "Unable to create local context");