checking errcode in the sql_snprint_error function of rlm_sql_oracle.c

Kyuyoung Kim jadebrill at
Fri Nov 27 02:08:59 CET 2015

First, I want to say that I don't know well OCI programming.
I'm trying to make interface between FreeRADIUS and Oracle.
I found this code in the rlm_sql_oracle module.
This part seems a bit strange.
If there are errors, errcode variable is larger than 0.
but, the function returns -1.
I think if errcode is large than 0, function should return 0 not -1.
Can you  tell me what is correct?

static int sql_snprint_error(char *out, size_t outlen, rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t *config)
 sb4   errcode = 0;
 rlm_sql_oracle_conn_t *conn = handle->conn;
 out[0] = '';
 OCIErrorGet((dvoid *) conn->error, 1, (OraText *) NULL, &errcode, (OraText *) out,
      outlen, OCI_HTYPE_ERROR);
 if (!errcode) return -1;
 return 0;

More information about the Freeradius-Users mailing list