summaryrefslogtreecommitdiff
path: root/src/io.c
diff options
context:
space:
mode:
authorHenrik Riomar <henrik.riomar@gmail.com>2017-02-03 00:37:23 +0100
committerTimo Teräs <timo.teras@iki.fi>2017-02-15 13:44:04 +0200
commit349c61c9612a328f3a80f301d37aa8c14adcb43a (patch)
treefb779b62735e2cb47ed9f1d763bc1451ed19bcd9 /src/io.c
parent28a9dcda568c575c569ffa4b68775034b655230a (diff)
downloadapk-tools-349c61c9612a328f3a80f301d37aa8c14adcb43a.tar.gz
apk-tools-349c61c9612a328f3a80f301d37aa8c14adcb43a.tar.bz2
apk-tools-349c61c9612a328f3a80f301d37aa8c14adcb43a.tar.xz
apk-tools-349c61c9612a328f3a80f301d37aa8c14adcb43a.zip
add support for pre and post commit hooks
This allows for instance integration of etckeeper [TT: Reorganized code a bit, and modified to use single directory commit_hooks.d with argument for script of stage.]
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/io.c b/src/io.c
index b48f932..8cf867b 100644
--- a/src/io.c
+++ b/src/io.c
@@ -741,6 +741,7 @@ int apk_dir_foreach_file(int dirfd, apk_dir_file_cb cb, void *ctx)
{
struct dirent *de;
DIR *dir;
+ int ret = 0;
if (dirfd < 0)
return -1;
@@ -759,11 +760,11 @@ int apk_dir_foreach_file(int dirfd, apk_dir_file_cb cb, void *ctx)
(de->d_name[1] == '.' && de->d_name[2] == 0))
continue;
}
- cb(ctx, dirfd, de->d_name);
+ ret = cb(ctx, dirfd, de->d_name);
+ if (ret) break;
}
closedir(dir);
-
- return 0;
+ return ret;
}
struct apk_istream *apk_istream_from_file_gz(int atfd, const char *file)