summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-03-08 13:32:10 +0100
committerLinus Nordberg <linus@nordu.net>2011-03-08 13:32:10 +0100
commit657eec7ee5a276521eb456bf648878935e794b6e (patch)
treeef3f4e6a7a1b82eb7da72aca867645474aad8b36 /lib
parent1073de4a6139cf1b78ed82bc93e26be385cb76b1 (diff)
Clean up struct rs_error somewhat.
More to be done here!
Diffstat (limited to 'lib')
-rw-r--r--lib/err.c19
-rw-r--r--lib/examples/client-blocking.c2
-rw-r--r--lib/include/radsec/radsec-impl.h1
3 files changed, 6 insertions, 16 deletions
diff --git a/lib/err.c b/lib/err.c
index 55fc5de..e2112c3 100644
--- a/lib/err.c
+++ b/lib/err.c
@@ -178,7 +178,9 @@ rs_err_conn_pop (struct rs_connection *conn)
int
rs_err_conn_peek_code (struct rs_connection *conn)
{
- if (conn && conn->err)
+ if (!conn)
+ return -1; /* FIXME: RSE_INVALID_CONN */
+ if (conn->err)
return conn->err->code;
else
return RSE_OK;
@@ -188,26 +190,15 @@ void
rs_err_free (struct rs_error *err)
{
assert (err);
- if (err->msg)
- free (err->msg);
free (err);
}
char *
-rs_err_msg (struct rs_error *err, int dofree_flag)
+rs_err_msg (struct rs_error *err)
{
- char *msg;
-
if (!err)
return NULL;
- if (err->msg)
- msg = err->msg;
- else
- msg = strdup (err->buf);
-
- if (dofree_flag)
- rs_err_free (err);
- return msg;
+ return err->buf;
}
int
diff --git a/lib/examples/client-blocking.c b/lib/examples/client-blocking.c
index 31fd6d1..ef361e5 100644
--- a/lib/examples/client-blocking.c
+++ b/lib/examples/client-blocking.c
@@ -100,7 +100,7 @@ main (int argc, char *argv[])
err = blocking_client (argv[1], argv[2], use_request_object_flag);
if (err)
{
- fprintf (stderr, "%s\n", rs_err_msg (err, 0));
+ fprintf (stderr, "%s\n", rs_err_msg (err));
return rs_err_code (err, 1);
}
return 0;
diff --git a/lib/include/radsec/radsec-impl.h b/lib/include/radsec/radsec-impl.h
index e790ccf..a924fc9 100644
--- a/lib/include/radsec/radsec-impl.h
+++ b/lib/include/radsec/radsec-impl.h
@@ -32,7 +32,6 @@ struct rs_credentials {
struct rs_error {
int code;
- char *msg;
char buf[1024];
};