Skip to content

Commit

Permalink
iiod: Print error message when more parameters are needed
Browse files Browse the repository at this point in the history
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 <paul@crapouillou.net>
  • Loading branch information
pcercuei committed Dec 11, 2023
1 parent b7bd31c commit 56e120f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions iiod/iiod.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 56e120f

Please sign in to comment.