summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-31 16:08:09 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-31 16:08:09 +0300
commitea901526648c43ef8e961b3d7e051b9ca14b65ca (patch)
treecea5a96dc83518a94f79dddd645f3e4404179530 /src/index.c
parent67108bf07a67811ea91fc965f3f1592a4a70044e (diff)
downloadapk-tools-ea901526648c43ef8e961b3d7e051b9ca14b65ca.tar.gz
apk-tools-ea901526648c43ef8e961b3d7e051b9ca14b65ca.tar.bz2
apk-tools-ea901526648c43ef8e961b3d7e051b9ca14b65ca.tar.xz
apk-tools-ea901526648c43ef8e961b3d7e051b9ca14b65ca.zip
apk: use *at instead of chdir+normal file syscall
this way we never change cwd, and relative filenames are always parsed consistently. this also helps filename construction in many places. this patch also changes '--root' to override location of all configuration to be in the new root. previously it depended on the file which one was used.
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/index.c b/src/index.c
index c27d020..4ef8aef 100644
--- a/src/index.c
+++ b/src/index.c
@@ -55,7 +55,7 @@ static int index_read_file(struct apk_database *db, struct index_ctx *ictx)
if (ictx->index == NULL)
return 0;
- if (apk_file_get_info(ictx->index, APK_CHECKSUM_NONE, &fi) < 0)
+ if (apk_file_get_info(AT_FDCWD, ictx->index, APK_CHECKSUM_NONE, &fi) < 0)
return -1;
ictx->index_mtime = fi.mtime;
@@ -107,7 +107,7 @@ static int index_main(void *ctx, int argc, char **argv)
}
for (i = 0; i < argc; i++) {
- if (apk_file_get_info(argv[i], APK_CHECKSUM_NONE, &fi) < 0) {
+ if (apk_file_get_info(AT_FDCWD, argv[i], APK_CHECKSUM_NONE, &fi) < 0) {
apk_warning("File '%s' is unaccessible", argv[i]);
continue;
}
@@ -154,7 +154,7 @@ static int index_main(void *ctx, int argc, char **argv)
if (!found) {
struct apk_sign_ctx sctx;
- apk_sign_ctx_init(&sctx, ictx->method, NULL);
+ apk_sign_ctx_init(&sctx, ictx->method, NULL, db.keys_fd);
if (apk_pkg_read(&db, argv[i], &sctx, NULL) == 0)
newpkgs++;
apk_sign_ctx_free(&sctx);
@@ -171,7 +171,7 @@ static int index_main(void *ctx, int argc, char **argv)
}
if (ictx->output != NULL)
- os = apk_ostream_to_file(ictx->output, 0644);
+ os = apk_ostream_to_file(AT_FDCWD, ictx->output, 0644);
else
os = apk_ostream_to_fd(STDOUT_FILENO);
if (ictx->method == APK_SIGN_GENERATE) {