keyutil.c: Remove stray tabs and trailing space from the list format.
[u/mdw/catacomb] / keyutil.c
index bae57cf..74f6409 100644 (file)
--- a/keyutil.c
+++ b/keyutil.c
@@ -235,8 +235,12 @@ static int copyparam(keyopts *k, const char **pp)
 {
   key_filter kf;
   key_attriter i;
+  key_data *kd;
   const char *n, *v;
 
+  kf.f = KCAT_SHARE;
+  kf.m = KF_CATMASK;
+
   /* --- Quick check if no parameters supplied --- */
 
   if (!k->p)
@@ -248,16 +252,17 @@ static int copyparam(keyopts *k, const char **pp)
     key_data *kd = key_structfind(k->p->k, *pp);
     if (!kd)
       die(EXIT_FAILURE, "bad parameter key: parameter `%s' not found", *pp);
-    if ((kd->e & KF_CATMASK) != KCAT_SHARE)
+    if (!KEY_MATCH(kd, &kf))
       die(EXIT_FAILURE, "bad parameter key: subkey `%s' is not shared", *pp);
     pp++;
   }
 
   /* --- Copy over the parameters --- */
 
-  kf.f = KCAT_SHARE;
-  kf.m = KF_CATMASK;
-  key_setkeydata(k->kf, k->k, k->p->k);
+  kd = key_copydata(k->p->k, &kf);
+  assert(kd);
+  key_setkeydata(k->kf, k->k, kd);
+  key_drop(kd);
 
   /* --- Copy over attributes --- */
 
@@ -1437,10 +1442,10 @@ static void showkey(key *k, listopts *o)
 
   if (!o->v) {
     if (!(o->f & f_newline)) {
-      printf("%8s  %-20s  %-20s         %-10s  %-10s\n",
+      printf("%8s  %-20s  %-20s  %-10s  %s\n",
             "Id", "Tag", "Type", "Expire", "Delete");
     }
-    printf("%08lx  %-20s  %-20s         %-10s  %-10s\n",
+    printf("%08lx  %-20s  %-20s  %-10s  %s\n",
           (unsigned long)k->id, k->tag ? k->tag : "<none>",
           k->type, ebuf, dbuf);
     o->f |= f_newline;