Commit 64a1d5e7 authored by Vsevolod Stakhov's avatar Vsevolod Stakhov Committed by Baptiste Daroussin
Browse files

Add legacy/v2 selection routine

parent c6d1e930
......@@ -680,10 +680,12 @@ pkg_open_v2(struct pkg **pkg_p, const char *path,
return (EPKG_FATAL);
}
}
return (ret);
}
int
pkg_open_format(struct pkg **pkg_p, struct archive **a, struct archive_entry **ae,
static int
pkg_open_legacy(struct pkg **pkg_p, struct archive **a, struct archive_entry **ae,
const char *path, struct pkg_manifest_key *keys, int flags, int fd)
{
struct pkg *pkg = NULL;
......@@ -809,3 +811,19 @@ pkg_open_format(struct pkg **pkg_p, struct archive **a, struct archive_entry **a
return (retcode);
}
int
pkg_open_format(struct pkg **pkg_p, struct archive **a, struct archive_entry **ae,
const char *path, struct pkg_manifest_key *keys, int flags, int fd)
{
int ret;
if ((ret = pkg_open_v2(pkg_p, path, a, ae, keys, flags)) != EPKG_OK) {
if (ret == EPKG_END) {
/* Legacy format */
return (pkg_open_legacy(pkg_p, a, ae, path, keys, flags, fd));
}
}
return (ret);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment