diff --git a/src/at.c b/src/at.c index 399913c..2527bca 100644 --- a/src/at.c +++ b/src/at.c @@ -68,8 +68,14 @@ gboolean at_send_command(struct EG25Manager *manager) else if (at_cmd->subcmd && at_cmd->value) len = snprintf(command, sizeof(command), "AT+%s=\"%s\",%s\r\n", at_cmd->cmd, at_cmd->subcmd, at_cmd->value); - if (len < 0 || len >= sizeof(command)) { - g_warning("AT command does not fit into buffer\n"); + if (len < 0) { + g_warning("snprintf(3) failed"); + at_next_command(manager); + return FALSE; + } + else if (len >= sizeof(command)) { + g_warning("AT command does not fit into buffer " + "(%d bytes required, %zu available)", len, sizeof(command)); at_next_command(manager); return FALSE; }