diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-11-11 11:24:49 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-11-11 11:24:49 +0200 |
commit | 97e3647e1d1684724d75daeda56e1fcb42fa2e7e (patch) | |
tree | 529e30b63db3f9a601cbc92756410c010d6c3795 /src | |
parent | 9d7b4bd25314dd4c726106e6573d20a34ee2e70d (diff) | |
download | apk-tools-97e3647e1d1684724d75daeda56e1fcb42fa2e7e.tar.gz apk-tools-97e3647e1d1684724d75daeda56e1fcb42fa2e7e.tar.bz2 apk-tools-97e3647e1d1684724d75daeda56e1fcb42fa2e7e.tar.xz apk-tools-97e3647e1d1684724d75daeda56e1fcb42fa2e7e.zip |
pathbuilder: fix push return value
Always return the original length; not the one with trailing '/'
amended.
fixes c60b7424 "optimize apk_pathbuilder_pop to get the old length"
ref #10784
Diffstat (limited to 'src')
-rw-r--r-- | src/pathbuilder.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pathbuilder.c b/src/pathbuilder.c index 277d0c2..3f25cf8 100644 --- a/src/pathbuilder.c +++ b/src/pathbuilder.c @@ -11,13 +11,13 @@ int apk_pathbuilder_pushb(struct apk_pathbuilder *pb, apk_blob_t b) { - size_t i = pb->namelen; + size_t oldlen = pb->namelen, i = pb->namelen; if (i + b.len + 2 >= ARRAY_SIZE(pb->name)) return -ENAMETOOLONG; if (i) pb->name[i++] = '/'; memcpy(&pb->name[i], b.ptr, b.len); pb->namelen = i + b.len; pb->name[pb->namelen] = 0; - return i; + return oldlen; } void apk_pathbuilder_pop(struct apk_pathbuilder *pb, int pos) |