summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-01-21 09:59:12 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-01-21 09:59:12 +0000
commitdfc8d4ce4c6e8fdc30491d52e2014bd33d961dee (patch)
tree7d87c1c7076eab82c00ad1abe6b7dbc705da8d42
parent600f9e7e031c9e7244e078f35ec6c8dce1011149 (diff)
downloadapk-tools-dfc8d4ce4c6e8fdc30491d52e2014bd33d961dee.tar.bz2
apk-tools-dfc8d4ce4c6e8fdc30491d52e2014bd33d961dee.tar.xz
Revert "Revert "pkg: use absolute filenames for packages""
This reverts commit 600f9e7e031c9e7244e078f35ec6c8dce1011149. My bad. This was correct.
-rw-r--r--src/package.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/package.c b/src/package.c
index d4147ff..25f09d6 100644
--- a/src/package.c
+++ b/src/package.c
@@ -13,6 +13,7 @@
#include <fcntl.h>
#include <ctype.h>
#include <stdio.h>
+#include <limits.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
@@ -325,12 +326,16 @@ struct apk_package *apk_pkg_read(struct apk_database *db, const char *file)
{
struct read_info_ctx ctx;
struct apk_bstream *bs;
+ char realfile[PATH_MAX];
+
+ if (realpath(file, realfile) < 0)
+ return NULL;
ctx.pkg = apk_pkg_new();
if (ctx.pkg == NULL)
return NULL;
- bs = apk_bstream_from_file(file);
+ bs = apk_bstream_from_file(realfile);
if (bs == NULL)
goto err;
@@ -355,7 +360,7 @@ struct apk_package *apk_pkg_read(struct apk_database *db, const char *file)
};
apk_deps_add(&ctx.pkg->depends, &dep);
}
- ctx.pkg->filename = strdup(file);
+ ctx.pkg->filename = strdup(realfile);
return ctx.pkg;
err: