X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwgtpkg-zip.c;h=a182261549bcd021d4a955d8d2a7787b9e60c5b5;hb=7cf2890d871e76c082528565f59e1d0d1055b7f9;hp=e450c0fdcb984909aaee61d1cb8972944a35f705;hpb=512e870e35747c6114e0dd5e0d94060b3b3cf6a5;p=src%2Fapp-framework-main.git diff --git a/src/wgtpkg-zip.c b/src/wgtpkg-zip.c index e450c0f..a182261 100644 --- a/src/wgtpkg-zip.c +++ b/src/wgtpkg-zip.c @@ -243,6 +243,7 @@ static int zwr(struct zws *zws, size_t offset) zip_int64_t z64; struct zip_source *zsrc; FILE *fp; + struct stat st; fd = openat(workdirfd, offset ? zws->name : ".", O_DIRECTORY|O_RDONLY); if (fd < 0) { @@ -275,6 +276,13 @@ static int zwr(struct zws *zws, size_t offset) ERROR("invalid name %s", zws->name); goto error; } + if (ent->d_type == DT_UNKNOWN) { + fstatat(fd, ent->d_name, &st, 0); + if (S_ISREG(st.st_mode)) + ent->d_type = DT_REG; + else if (S_ISDIR(st.st_mode)) + ent->d_type = DT_DIR; + } switch (ent->d_type) { case DT_DIR: z64 = zip_dir_add(zws->zip, zws->name, ZIP_FL_ENC_UTF_8);