rpmlead rpmLeadFree(rpmlead lead)
{
- assert(lead != NULL);
free(lead);
return NULL;
}
/* The lead needs to be 8 byte aligned */
rpmRC rpmLeadWrite(FD_t fd, rpmlead lead)
{
- struct rpmlead_s l;
- assert(lead != NULL);
-
- memcpy(&l, lead, sizeof(l));
-
- l.type = htons(lead->type);
- l.archnum = htons(lead->archnum);
- l.osnum = htons(lead->osnum);
- l.signature_type = htons(lead->signature_type);
-
- if (Fwrite(&l, 1, sizeof(l), fd) != sizeof(l))
- return RPMRC_FAIL;
+ rpmRC rc = RPMRC_FAIL;
- return RPMRC_OK;
+ if (lead != NULL) {
+ struct rpmlead_s l;
+ memcpy(&l, lead, sizeof(l));
+
+ l.type = htons(lead->type);
+ l.archnum = htons(lead->archnum);
+ l.osnum = htons(lead->osnum);
+ l.signature_type = htons(lead->signature_type);
+
+ if (Fwrite(&l, 1, sizeof(l), fd) == sizeof(l))
+ rc = RPMRC_OK;
+ }
+ return rc;
}
rpmRC rpmLeadCheck(rpmlead lead, const char **msg)