Example code: Don't create rs_error on failing context creation.
authorLinus Nordberg <linus@nordberg.se>
Mon, 17 Dec 2012 15:05:55 +0000 (16:05 +0100)
committerLinus Nordberg <linus@nordberg.se>
Mon, 17 Dec 2012 15:05:55 +0000 (16:05 +0100)
We don't export err_create() and the error is ENOMEM nowadays.

lib/examples/client-blocking.c

index 7d3869a..7ba71a0 100644 (file)
@@ -25,12 +25,13 @@ blocking_client (const char *config_fn, const char *configuration,
   struct rs_request *request = NULL;
   struct rs_packet *req = NULL, *resp = NULL;
   struct rs_error *err = NULL;
+  int r;
 
-  if (rs_context_create (&h))
+  r = rs_context_create (&h);
+  if (r)
     {
-      err = err_create (RSE_INTERNAL, NULL, 0, "unable to create context");
-      assert (err != NULL);
-      return err;
+      assert(r == RSE_NOMEM);
+      assert (!"out of RAM -- unable to create libradsec context");
     }
 
 #if !defined (USE_CONFIG_FILE)