xbps-repo: report the errno string when a repository cannot be added and fix a NULL pointer deref.

This commit is contained in:
Juan RP 2010-12-25 02:35:11 +01:00
parent 5b101eae2b
commit 057deb180c

View File

@ -91,9 +91,8 @@ pkgindex_verify(const char *plist, const char *uri)
d = prop_dictionary_internalize_from_zfile(plist); d = prop_dictionary_internalize_from_zfile(plist);
if (d == NULL) { if (d == NULL) {
fprintf(stderr, fprintf(stderr, "E: failed to add '%s' repository: %s\n",
"E: repository %s does not contain any " uri, strerror(errno));
"xbps pkgindex file.\n", uri);
return NULL; return NULL;
} }
@ -228,10 +227,11 @@ register_repository(const char *uri)
idxstr, rpi->pkgidxver, rpi->totalpkgs); idxstr, rpi->pkgidxver, rpi->totalpkgs);
out: out:
if (rpi != NULL) {
if (rpi->pkgidxver != NULL) if (rpi->pkgidxver != NULL)
free(rpi->pkgidxver); free(rpi->pkgidxver);
if (rpi != NULL)
free(rpi); free(rpi);
}
if (plist != NULL) if (plist != NULL)
free(plist); free(plist);