Better error handling with eet identity.
authorcedric <cedric>
Fri, 5 Dec 2008 09:42:06 +0000 (09:42 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 5 Dec 2008 09:42:06 +0000 (09:42 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eet@37937 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/eet_main.c
src/lib/eet_cipher.c

index 114fffe..79dd490 100644 (file)
@@ -248,6 +248,11 @@ do_eet_sign(const char *file, const char *private_key, const char *public_key)
      }
 
    key = eet_identity_open(public_key, private_key, NULL);
+   if (!key)
+     {
+       fprintf(stdout, "cannot open key '%s:%s'.\n", public_key, private_key);
+       exit(-1);
+     }
 
    fprintf(stdout, "Using the following key to sign `%s`.\n", file);
    eet_identity_print(key, stdout);
index 96949f5..1bd67b4 100644 (file)
@@ -171,7 +171,7 @@ eet_identity_open(const char *certificate_file, const char *private_key_file, Ee
   if (!fp) return NULL;
   cert = PEM_read_X509(fp, NULL, NULL, NULL);
   fclose(fp);
-  if (!cert) return NULL;
+  if (!cert) goto on_error;
 
   /* Check the presence of the public key. Just in case. */
   pkey = X509_get_pubkey(cert);