diff --git a/bin/if.c b/bin/if.c index ac2ee06..f313922 100644 --- a/bin/if.c +++ b/bin/if.c @@ -127,7 +127,7 @@ error_invalid: static patty_ax25_if *create_aprs_is(struct context *ctx, int argc, char **argv) { - enum mode_aprs_is mode = MODE_APRS_IS_IFOPTS; + patty_ax25_if *iface; patty_ax25_aprs_is_info info = { .user = "N0CALL", @@ -137,6 +137,8 @@ static patty_ax25_if *create_aprs_is(struct context *ctx, .filter = "m/25" }; + enum mode_aprs_is mode = MODE_APRS_IS_IFOPTS; + int i; if (argc == 0) { @@ -213,11 +215,19 @@ static patty_ax25_if *create_aprs_is(struct context *ctx, } } - return patty_ax25_if_new( ctx->name, - &ctx->addr, - patty_ax25_aprs_is_driver(), - &info); + if ((iface = patty_ax25_if_new( ctx->name, + &ctx->addr, + patty_ax25_aprs_is_driver(), + &info)) == NULL) { + patty_error_fmt(ctx->err, "Unable to connect to APRS-IS service %s:%s: %s", + info.host, info.port, strerror(errno)); + goto error_if_new; + } + + return iface; + +error_if_new: error_invalid: return NULL; }