aboutsummaryrefslogtreecommitdiffstats
path: root/src/wgtpkg-pack.c
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-02-06 15:07:56 +0100
committerJose Bollo <jose.bollo@iot.bzh>2019-02-06 15:07:56 +0100
commitd0cb2a7a1e068a38b4a0c3216ccdbce0e33ecffb (patch)
treeecde0204132a9423ed47096cb292e9661ee30acf /src/wgtpkg-pack.c
parent48e894bee732315d89eb5b46d2432ed45fc81a43 (diff)
wgtpkg-pack: Ensure packing relative files
When running external ZIP program, ensures that the files are stored with a path relative to the root directory by changing the directory first. Also, tiny improvement in working directory handling. Change-Id: I3470c6c933aea9cd93dac197ff7f5e8a0ed86b23 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/wgtpkg-pack.c')
-rw-r--r--src/wgtpkg-pack.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wgtpkg-pack.c b/src/wgtpkg-pack.c
index 80ad87a..5a81d7e 100644
--- a/src/wgtpkg-pack.c
+++ b/src/wgtpkg-pack.c
@@ -161,13 +161,17 @@ int main(int ac, char **av)
/* compute absolutes paths */
x = realpath(wgtfile, NULL);
if (x == NULL) {
- ERROR("realpath failed for %s",wgtfile);
+ ERROR("realpath failed for %s", wgtfile);
return 1;
}
wgtfile = x;
/* set and enter the workdir */
- if (set_workdir(directory, 0))
+ if (chdir(directory)) {
+ ERROR("failed to enter directory %s", directory);
+ return 1;
+ }
+ if (set_workdir(".", 0))
return 1;