summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/extract-openssl.c9
-rw-r--r--tools/extract.c3
-rw-r--r--tools/tool.c3
3 files changed, 11 insertions, 4 deletions
diff --git a/tools/extract-openssl.c b/tools/extract-openssl.c
index fb87cd6..ae1bc27 100644
--- a/tools/extract-openssl.c
+++ b/tools/extract-openssl.c
@@ -613,6 +613,7 @@ p11_extract_openssl_directory (P11KitIter *iter,
* conflicts with something we've already written out.
*/
+ ret = true;
linkname = symlink_for_subject_hash (ex);
if (file && linkname) {
ret = p11_save_symlink_in (dir, linkname, ".0", filename);
@@ -620,12 +621,16 @@ p11_extract_openssl_directory (P11KitIter *iter,
}
linkname = symlink_for_subject_old_hash (ex);
- if (file && linkname) {
+ if (ret && file && linkname) {
ret = p11_save_symlink_in (dir, linkname, ".0", filename);
free (linkname);
}
- ret = p11_save_write_and_finish (file, pem, length);
+ if (ret)
+ ret = p11_save_write_and_finish (file, pem, length);
+ else
+ p11_save_finish_file (file, false);
+
free (name);
free (pem);
}
diff --git a/tools/extract.c b/tools/extract.c
index abbb300..40a3911 100644
--- a/tools/extract.c
+++ b/tools/extract.c
@@ -238,6 +238,9 @@ limit_modules_if_necessary (CK_FUNCTION_LIST_PTR *modules,
/* Count the number of modules */
for (out = 0; modules[out] != NULL; out++);
+ if (out == 0)
+ return;
+
order = malloc (sizeof (*order) * out);
return_if_fail (order != NULL);
diff --git a/tools/tool.c b/tools/tool.c
index c825277..e971845 100644
--- a/tools/tool.c
+++ b/tools/tool.c
@@ -117,7 +117,7 @@ p11_tool_usage (const p11_tool_desc *usages,
len = printf (" --%s", long_name);
else
len = printf (" -%c", (int)short_name);
- if (longopt->has_arg)
+ if (longopt && longopt->has_arg)
len += printf ("%s<%s>",
long_name ? "=" : " ",
usages[i].arg ? usages[i].arg : "...");
@@ -241,7 +241,6 @@ main (int argc, char *argv[])
*/
for (in = 1, out = 1; in < argc; in++, out++) {
- skip = false;
/* Already seen the command, keep the arguments */
if (command) {