Fix triggerconds return when no data is there (rhbz#474550)
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 4 Dec 2008 17:10:41 +0000 (19:10 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 4 Dec 2008 19:40:36 +0000 (21:40 +0200)
lib/tagexts.c

index 44d8dfc..8a60d55 100644 (file)
@@ -257,9 +257,8 @@ static int triggercondsTag(Header h, rpmtd td)
     struct rpmtd_s nametd, indextd, flagtd, versiontd, scripttd;
     int hgeflags = HEADERGET_MINMEM;
 
-    td->type = RPM_STRING_ARRAY_TYPE;
     if (!headerGet(h, RPMTAG_TRIGGERNAME, &nametd, hgeflags)) {
-       return 1;
+       return 0;
     }
 
     headerGet(h, RPMTAG_TRIGGERINDEX, &indextd, hgeflags);
@@ -267,6 +266,7 @@ static int triggercondsTag(Header h, rpmtd td)
     headerGet(h, RPMTAG_TRIGGERVERSION, &versiontd, hgeflags);
     headerGet(h, RPMTAG_TRIGGERSCRIPTS, &scripttd, hgeflags);
 
+    td->type = RPM_STRING_ARRAY_TYPE;
     td->flags = RPMTD_ALLOCED | RPMTD_PTR_ALLOCED;
     td->data = conds = xmalloc(sizeof(*conds) * rpmtdCount(&scripttd));
     td->count = rpmtdCount(&scripttd);