remove errmsg param, its in the struct now passed as the first param
This commit is contained in:
parent
3c91457bce
commit
b5dec9dde8
|
@ -53,14 +53,12 @@ static char copyright[] =
|
||||||
* return:
|
* return:
|
||||||
*
|
*
|
||||||
* exit = GET_MIB2_OK if close succeeded
|
* exit = GET_MIB2_OK if close succeeded
|
||||||
* GET_MIB2_* is the error code for failure and:
|
* GET_MIB2_* is the error code.
|
||||||
* *errmsg = failure error message
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
close_mib2(solaris_mib2_t *mib2, char **errmsg)
|
close_mib2(solaris_mib2_t *mib2)
|
||||||
{
|
{
|
||||||
*errmsg = mib2->errmsg;
|
|
||||||
if (mib2->sd < 0) {
|
if (mib2->sd < 0) {
|
||||||
(void) strcpy(mib2->errmsg, "close_mib2: socket not open");
|
(void) strcpy(mib2->errmsg, "close_mib2: socket not open");
|
||||||
return(GET_MIB2_ERR_NOTOPEN);
|
return(GET_MIB2_ERR_NOTOPEN);
|
||||||
|
@ -93,16 +91,14 @@ close_mib2(solaris_mib2_t *mib2, char **errmsg)
|
||||||
* *opt = opthdr structure address
|
* *opt = opthdr structure address
|
||||||
* *data = data buffer address
|
* *data = data buffer address
|
||||||
* *datalen = size of data buffer
|
* *datalen = size of data buffer
|
||||||
* GET_MIB2_* is the error code for failure and:
|
* GET_MIB2_* is the error code for failure.
|
||||||
* *errmsg = failure error message
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
get_mib2(solaris_mib2_t *mib2,
|
get_mib2(solaris_mib2_t *mib2,
|
||||||
struct opthdr **opt,
|
struct opthdr **opt,
|
||||||
char **data,
|
char **data,
|
||||||
int *datalen,
|
int *datalen)
|
||||||
char **errmsg)
|
|
||||||
{
|
{
|
||||||
struct T_optmgmt_ack *a; /* message ACK pointer */
|
struct T_optmgmt_ack *a; /* message ACK pointer */
|
||||||
struct strbuf c; /* streams control buffer */
|
struct strbuf c; /* streams control buffer */
|
||||||
|
@ -114,7 +110,6 @@ get_mib2(solaris_mib2_t *mib2,
|
||||||
struct T_optmgmt_req *r; /* message request pointer */
|
struct T_optmgmt_req *r; /* message request pointer */
|
||||||
int rc; /* reply code */
|
int rc; /* reply code */
|
||||||
|
|
||||||
*errmsg = mib2->errmsg;
|
|
||||||
/*
|
/*
|
||||||
* If MIB2 access isn't open, open it and issue the preliminary stream
|
* If MIB2 access isn't open, open it and issue the preliminary stream
|
||||||
* messages.
|
* messages.
|
||||||
|
@ -124,7 +119,7 @@ get_mib2(solaris_mib2_t *mib2,
|
||||||
/*
|
/*
|
||||||
* Open access. Return on error.
|
* Open access. Return on error.
|
||||||
*/
|
*/
|
||||||
if ((err = open_mib2(mib2, errmsg))) {
|
if ((err = open_mib2(mib2))) {
|
||||||
return(err);
|
return(err);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -184,7 +179,7 @@ get_mib2(solaris_mib2_t *mib2,
|
||||||
&& a->MGMT_flags == T_SUCCESS
|
&& a->MGMT_flags == T_SUCCESS
|
||||||
&& o->len == 0)
|
&& o->len == 0)
|
||||||
{
|
{
|
||||||
err = close_mib2(mib2, errmsg);
|
err = close_mib2(mib2);
|
||||||
if (err) {
|
if (err) {
|
||||||
return(err);
|
return(err);
|
||||||
}
|
}
|
||||||
|
@ -267,14 +262,12 @@ get_mib2(solaris_mib2_t *mib2,
|
||||||
* return:
|
* return:
|
||||||
*
|
*
|
||||||
* exit = GET_MIB2_OK if open succeeded
|
* exit = GET_MIB2_OK if open succeeded
|
||||||
* GET_MIB2_* is the error code for failure and:
|
* GET_MIB2_* is the error code for failure.
|
||||||
* *errmsg = failure error message
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
open_mib2(solaris_mib2_t *mib2, char **errmsg)
|
open_mib2(solaris_mib2_t *mib2)
|
||||||
{
|
{
|
||||||
*errmsg = mib2->errmsg;
|
|
||||||
/*
|
/*
|
||||||
* It's an error if the stream device is already open.
|
* It's an error if the stream device is already open.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -103,36 +103,18 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int close_mib2( /* close acccess to MIB2 information */
|
int close_mib2( /* close acccess to MIB2 information */
|
||||||
solaris_mib2_t *mib2,
|
solaris_mib2_t *mib2
|
||||||
char **errmsg /* error message buffer return
|
|
||||||
* address (if return value
|
|
||||||
* > GET_MIB2_OK.) The error
|
|
||||||
* message buffer address will
|
|
||||||
* be NULL if no buffer has
|
|
||||||
* been defined. */
|
|
||||||
);
|
);
|
||||||
int get_mib2( /* get MIB2 information */
|
int get_mib2( /* get MIB2 information */
|
||||||
solaris_mib2_t *mib2,
|
solaris_mib2_t *mib2,
|
||||||
struct opthdr **opt, /* opthdr pointer return (see
|
struct opthdr **opt, /* opthdr pointer return (see
|
||||||
* <sys/socket.h> */
|
* <sys/socket.h> */
|
||||||
char **data, /* data buffer return address */
|
char **data, /* data buffer return address */
|
||||||
int *datalen, /* data buffer length return
|
int *datalen /* data buffer length return
|
||||||
* address */
|
* address */
|
||||||
char **errmsg /* error message buffer return
|
|
||||||
* address (if return value
|
|
||||||
* > GET_MIB2_OK.) The error
|
|
||||||
* message buffer address will
|
|
||||||
* be NULL if no buffer has
|
|
||||||
* been defined. */
|
|
||||||
);
|
);
|
||||||
int open_mib2( /* open acccess to MIB2 information */
|
int open_mib2( /* open acccess to MIB2 information */
|
||||||
solaris_mib2_t *mib2,
|
solaris_mib2_t *mib2
|
||||||
char **errmsg /* error message buffer return
|
|
||||||
* address (if return value
|
|
||||||
* > GET_MIB2_OK.) The error
|
|
||||||
* message buffer address will
|
|
||||||
* be NULL if no buffer has
|
|
||||||
* been defined. */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif /* !defined(GET_MIB2_H) */
|
#endif /* !defined(GET_MIB2_H) */
|
||||||
|
|
Loading…
Reference in New Issue