log UPDATE partially replace ERRARG macro
Added new macro, which works just like ERRARG did before, but it can
take variadic number (up to 5) of arguments and a session the error happened on.
ERRARG still remains and has an extra session argument.
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index 34db658..0b7aad8 100644
--- a/src/session_server_ssh.c
+++ b/src/session_server_ssh.c
@@ -551,10 +551,7 @@
static int
nc_server_ssh_set_auth_attempts(uint16_t auth_attempts, struct nc_server_ssh_opts *opts)
{
- if (!auth_attempts) {
- ERRARG("auth_attempts");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, auth_attempts, -1);
opts->auth_attempts = auth_attempts;
return 0;
@@ -604,10 +601,7 @@
static int
nc_server_ssh_set_auth_timeout(uint16_t auth_timeout, struct nc_server_ssh_opts *opts)
{
- if (!auth_timeout) {
- ERRARG("auth_timeout");
- return -1;
- }
+ NC_CHECK_ARG_RET(NULL, auth_timeout, -1);
opts->auth_timeout = auth_timeout;
return 0;
@@ -1953,13 +1947,7 @@
struct nc_session *new_session = NULL;
struct timespec ts_cur;
- if (!orig_session) {
- ERRARG("orig_session");
- return NC_MSG_ERROR;
- } else if (!session) {
- ERRARG("session");
- return NC_MSG_ERROR;
- }
+ NC_CHECK_ARG_RET(orig_session, orig_session, session, NC_MSG_ERROR);
if ((orig_session->status == NC_STATUS_RUNNING) && (orig_session->ti_type == NC_TI_LIBSSH) &&
orig_session->ti.libssh.next) {
@@ -2010,13 +1998,7 @@
struct timespec ts_cur;
uint16_t i;
- if (!ps) {
- ERRARG("ps");
- return NC_MSG_ERROR;
- } else if (!session) {
- ERRARG("session");
- return NC_MSG_ERROR;
- }
+ NC_CHECK_ARG_RET(NULL, ps, session, NC_MSG_ERROR);
/* LOCK */
if (nc_ps_lock(ps, &q_id, __func__)) {