From 9c5ddcc976e4ba353d4a4f45844461a8f846560e Mon Sep 17 00:00:00 2001 From: Alistair King Date: Thu, 7 Mar 2019 10:24:52 -0800 Subject: [PATCH 01/20] Replace use of `off_t` with `int64_t` We addressed this originally in d385220367982fde1aa29ff0764dbfac58f5c8b7, but recently added helper functions (based on an older version of wandio) were still using `off_t`. --- lib/wandio.c | 6 +++--- lib/wandio.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/wandio.c b/lib/wandio.c index 59ed997..31c8b2e 100644 --- a/lib/wandio.c +++ b/lib/wandio.c @@ -487,7 +487,7 @@ DLLEXPORT void wandio_wdestroy(iow_t *iow) { /** Alistair's API extensions from "wandio_util" */ -DLLEXPORT int64_t wandio_generic_fgets(void *file, void *buffer, off_t len, +DLLEXPORT int64_t wandio_generic_fgets(void *file, void *buffer, int64_t len, int chomp, read_cb_t *read_cb) { assert(file != NULL); @@ -588,7 +588,7 @@ DLLEXPORT int wandio_detect_compression_type(const char *filename) { return WANDIO_COMPRESS_NONE; } -DLLEXPORT inline off_t wandio_vprintf(iow_t *file, const char *format, +DLLEXPORT inline int64_t wandio_vprintf(iow_t *file, const char *format, va_list args) { assert(file != NULL); char *buf; @@ -605,7 +605,7 @@ DLLEXPORT inline off_t wandio_vprintf(iow_t *file, const char *format, return len; } -DLLEXPORT inline off_t wandio_printf(iow_t *file, const char *format, ...) { +DLLEXPORT inline int64_t wandio_printf(iow_t *file, const char *format, ...) { va_list ap; va_start(ap, format); diff --git a/lib/wandio.h b/lib/wandio.h index 74552ad..0bfe317 100644 --- a/lib/wandio.h +++ b/lib/wandio.h @@ -376,7 +376,7 @@ typedef int64_t(read_cb_t)(void *file, void *buffer, int64_t len); * @param chomp Should the newline be removed * @return the number of bytes actually read */ -int64_t wandio_generic_fgets(void *file, void *buffer, off_t len, int chomp, +int64_t wandio_generic_fgets(void *file, void *buffer, int64_t len, int chomp, read_cb_t *read_cb); /** Read a line from the given wandio file pointer @@ -406,7 +406,7 @@ int wandio_detect_compression_type(const char *filename); * The arguments for this function are the same as those for vprintf(3). See the * vprintf(3) manpage for more details. */ -off_t wandio_vprintf(iow_t *file, const char *format, va_list args); +int64_t wandio_vprintf(iow_t *file, const char *format, va_list args); /** Print a string to a wandio file using a printf-style API * @@ -418,7 +418,7 @@ off_t wandio_vprintf(iow_t *file, const char *format, va_list args); * The arguments for this function are the same as those for printf(3). See the * printf(3) manpage for more details. */ -off_t wandio_printf(iow_t *file, const char *format, ...); +int64_t wandio_printf(iow_t *file, const char *format, ...); /** @} */ #ifdef __cplusplus From 6b7bf07e5cb521634a7171c61aba3dcd37f954c7 Mon Sep 17 00:00:00 2001 From: Derrick Lyndon Pallas Date: Tue, 9 Apr 2019 20:44:26 +0000 Subject: [PATCH 02/20] iow-thread: avoid zero-length writes when closing In thread_consumer, when we exit the inner loop because the program is over, the current buffer may be completely empty. In that case, we perform a zero-length call to wandio_wwrite, where an uninitialized read occurs. Since the last buffer might be partially filled, we can't just jump out of the outer loop. Instead, just make sure to avoid calling wandio_wwrite with a completely empty buffer. Found with Valgrind. --- lib/iow-thread.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/iow-thread.c b/lib/iow-thread.c index 86c07f5..d045331 100644 --- a/lib/iow-thread.c +++ b/lib/iow-thread.c @@ -118,9 +118,11 @@ static void *thread_consumer(void *userdata) { } /* Empty the buffer using the child writer */ pthread_mutex_unlock(&DATA(state)->mutex); - wandio_wwrite(DATA(state)->iow, - DATA(state)->buffer[buffer].buffer, - DATA(state)->buffer[buffer].len); + if (DATA(state)->buffer[buffer].len > 0) { + wandio_wwrite(DATA(state)->iow, + DATA(state)->buffer[buffer].buffer, + DATA(state)->buffer[buffer].len); + } if (DATA(state)->buffer[buffer].flush) { wandio_wflush(DATA(state)->iow); } From 26f92cba011cdc7ac128849838486292a836a3cb Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Fri, 12 Apr 2019 11:19:54 +1200 Subject: [PATCH 03/20] Acknowledge Derrick's contribution --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index b18d646..1eb0dab 100644 --- a/AUTHORS +++ b/AUTHORS @@ -15,4 +15,7 @@ Thanks to Sergey Cherepanov for adding support for lz4. Thanks to Mingwei Zhang for adding ability to resume HTTP reads and fixing a ton of lazy error checking issues. +Thanks to Derrick Lyndon Pallas for fixing an uninitialised memory error +when closing a wandio writer. + Thanks to Brad Cowie for packaging libwandio for Debian. From 98f303d6a52e4c9114c59b1f7bb1b46c606f4f06 Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Thu, 9 May 2019 14:25:45 +1200 Subject: [PATCH 04/20] Update bintray_upload.sh to try and use a better RPM repo structure --- bintray-upload.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/bintray-upload.sh b/bintray-upload.sh index 4e9c989..523d8de 100755 --- a/bintray-upload.sh +++ b/bintray-upload.sh @@ -40,15 +40,33 @@ for path in `find built-packages/ -maxdepth 1 -type d`; do rev_filename=`echo ${pkg_filename} | rev` if [[ "$1" =~ centos_* ]]; then + # centos pkg_name=`echo ${rev_filename} | cut -d '-' -f4- | rev` pkg_version=`echo ${rev_filename} | cut -d '-' -f1-3 | rev | cut -d '.' -f1-3` + pkg_arch=`echo ${rev_filename} | cut -d '-' -f1 | rev | cut -d '.' -f1` + pkg_dist=centos + pkg_rel=`echo ${rev_filename} | cut -d '.' -f2 | rev | cut -d '-' -f 1` + + if [ "$pkg_rel" = "el6" ]; then + releasever=6 + elif [ "$pkg_rel" = "el7" ]; then + releasever=7 + else + releasever=unknown + fi + else + # fedora pkg_name=`echo ${rev_filename} | cut -d '-' -f3- | rev` pkg_version=`echo ${rev_filename} | cut -d '-' -f1-2 | rev | cut -d '.' -f1-3` + pkg_arch=`echo ${rev_filename} | cut -d '.' -f2 | rev` + pkg_dist=fedora + pkg_rel=`echo ${rev_filename} | cut -d '.' -f3 | rev` + releasever="${pkg_rel:2}" fi jfrog bt package-create --licenses ${BINTRAY_LICENSE} --vcs-url ${CI_PROJECT_URL} ${BINTRAY_RPM_REPO}/${pkg_name} || true - jfrog bt upload ${deb} ${BINTRAY_RPM_REPO}/${pkg_name}/${pkg_version} + jfrog bt upload ${deb} ${BINTRAY_RPM_REPO}/${pkg_name}/${pkg_version} ${pkg_dist}/${releasever}/${pkg_arch}/ fi done From 1c364ae6141cc8e91813b37736e5b0154c159684 Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Thu, 9 May 2019 14:26:15 +1200 Subject: [PATCH 05/20] Bump RPM revision number, so we can rebuild packages --- rpm/libwandio1.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rpm/libwandio1.spec b/rpm/libwandio1.spec index 7089115..a16bd65 100644 --- a/rpm/libwandio1.spec +++ b/rpm/libwandio1.spec @@ -1,6 +1,6 @@ Name: libwandio1 Version: 4.1.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: C Multi-Threaded File Compression and Decompression Library License: LGPLv3 @@ -73,6 +73,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' %{_bindir}/wandiocat %changelog +* Thu May 09 2019 Shane Alcock - 4.1.2-2 +- Re-built packages for new repository layout + * Thu Feb 21 2019 Shane Alcock - 4.1.0-1 - First libwandio package From 98a037cba796d23917cc775fe8f84fb03e89c69c Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Thu, 9 May 2019 14:48:40 +1200 Subject: [PATCH 06/20] Fix RPM build error when tag name contains a '-' Also ensure builddep is installed for dnf on systems that need it. --- gitlab-build-rpm.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gitlab-build-rpm.sh b/gitlab-build-rpm.sh index 2f1d07b..afc9dbc 100755 --- a/gitlab-build-rpm.sh +++ b/gitlab-build-rpm.sh @@ -3,6 +3,7 @@ set -x -e -o pipefail export QA_RPATHS=$[ 0x0001 ] +SOURCENAME=`echo ${CI_COMMIT_REF_NAME} | cut -d '-' -f 1` if [ "$1" = "centos7" ]; then yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm @@ -14,7 +15,7 @@ if [ "$1" = "centos6" ]; then fi if [[ "$1" =~ fedora* ]]; then - dnf install -y rpm-build rpmdevtools + dnf install -y rpm-build rpmdevtools 'dnf-command(builddep)' dnf group install -y "C Development Tools and Libraries" dnf builddep -y rpm/libwandio1.spec else @@ -26,7 +27,7 @@ fi rpmdev-setuptree ./bootstrap.sh && ./configure && make dist -cp wandio-*.tar.gz ~/rpmbuild/SOURCES/${CI_COMMIT_REF_NAME}.tar.gz +cp wandio-*.tar.gz ~/rpmbuild/SOURCES/${SOURCENAME}.tar.gz cp rpm/libwandio1.spec ~/rpmbuild/SPECS/ cd ~/rpmbuild && rpmbuild -bb --define "debug_package %{nil}" SPECS/libwandio1.spec From 282661f2c3160a0744a04387d39ec6c099fc5c68 Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Thu, 9 May 2019 14:49:28 +1200 Subject: [PATCH 07/20] Replace Fedora 28 support with Fedora 30 --- .gitlab-ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6984080..6206d20 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -87,13 +87,13 @@ build-amd64-fedora-29: only: - tags -build-amd64-fedora-28: +build-amd64-fedora-30: stage: build - image: fedora:28 + image: fedora:30 script: - - ./gitlab-build-rpm.sh fedora28 - - mkdir -p built-packages/fedora_28/ - - mv ~/rpmbuild/RPMS/x86_64/*.rpm built-packages/fedora_28/ + - ./gitlab-build-rpm.sh fedora30 + - mkdir -p built-packages/fedora_30/ + - mv ~/rpmbuild/RPMS/x86_64/*.rpm built-packages/fedora_30/ artifacts: paths: - built-packages/* @@ -177,11 +177,11 @@ run-unit-tests-fedora-29: only: - tags -run-unit-tests-fedora-28: +run-unit-tests-fedora-30: stage: test - image: fedora:28 + image: fedora:30 script: - - ./run-tests-rpm.sh fedora_28 + - ./run-tests-rpm.sh fedora_30 only: - tags From 5953d49dc9b64825e53ba88f7a38200cb170487b Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Thu, 9 May 2019 16:03:06 +1200 Subject: [PATCH 08/20] Make sure 'which' is installed on Fedora packaging systems We need 'which' for our ./bootstrap.sh to work properly. --- gitlab-build-rpm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab-build-rpm.sh b/gitlab-build-rpm.sh index afc9dbc..f2b0641 100755 --- a/gitlab-build-rpm.sh +++ b/gitlab-build-rpm.sh @@ -15,7 +15,7 @@ if [ "$1" = "centos6" ]; then fi if [[ "$1" =~ fedora* ]]; then - dnf install -y rpm-build rpmdevtools 'dnf-command(builddep)' + dnf install -y rpm-build rpmdevtools which 'dnf-command(builddep)' dnf group install -y "C Development Tools and Libraries" dnf builddep -y rpm/libwandio1.spec else From 3823ba754332cc6cc91d790ab0b7096c21810caf Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Thu, 9 May 2019 16:13:18 +1200 Subject: [PATCH 09/20] Ensure run-tests-rpm.sh works with tags that have '-' in their name. --- run-tests-rpm.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/run-tests-rpm.sh b/run-tests-rpm.sh index 72f794a..599c354 100755 --- a/run-tests-rpm.sh +++ b/run-tests-rpm.sh @@ -1,6 +1,7 @@ #!/bin/bash set -x -e -o pipefail +SOURCENAME=`echo ${CI_COMMIT_REF_NAME} | cut -d '-' -f 1` if [ "$1" = "centos_7" ]; then yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm @@ -13,9 +14,9 @@ fi yum install -y xz zstd gzip bzip2 lzop lz4 -yum install -y built-packages/$1/libwandio1-${CI_COMMIT_REF_NAME}-*.rpm -yum install -y built-packages/$1/libwandio1-devel-${CI_COMMIT_REF_NAME}-*.rpm -yum install -y built-packages/$1/libwandio1-tools-${CI_COMMIT_REF_NAME}-*.rpm +yum install -y built-packages/$1/libwandio1-${SOURCENAME}-*.rpm +yum install -y built-packages/$1/libwandio1-devel-${SOURCENAME}-*.rpm +yum install -y built-packages/$1/libwandio1-tools-${SOURCENAME}-*.rpm cd test && ./do-basic-tests.sh From 78fc313a4909c0d6c2822de61aee73b09dbe56a0 Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Thu, 9 May 2019 17:12:58 +1200 Subject: [PATCH 10/20] Fix various upload script errors * Fix bad license name (LGPL-3 vs LGPL-3.0) * Fix bad $linux_version for Debian and Ubuntu distros --- .gitlab-ci.yml | 30 +++++++++++++++--------------- bintray-upload.sh | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6206d20..8619813 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,8 +8,8 @@ build-amd64-debian-jessie: image: debian:jessie script: - ./gitlab-build.sh - - mkdir -p built-packages/debian_jessie/ - - mv ../*.deb built-packages/debian_jessie/ + - mkdir -p built-packages/jessie/ + - mv ../*.deb built-packages/jessie/ artifacts: paths: - built-packages/* @@ -22,8 +22,8 @@ build-amd64-debian-stretch: image: debian:stretch script: - ./gitlab-build.sh - - mkdir -p built-packages/debian_stretch/ - - mv ../*.deb built-packages/debian_stretch/ + - mkdir -p built-packages/stretch/ + - mv ../*.deb built-packages/stretch/ artifacts: paths: - built-packages/* @@ -36,8 +36,8 @@ build-amd64-ubuntu-xenial: image: ubuntu:xenial script: - ./gitlab-build.sh - - mkdir -p built-packages/ubuntu_xenial/ - - mv ../*.deb built-packages/ubuntu_xenial/ + - mkdir -p built-packages/xenial/ + - mv ../*.deb built-packages/xenial/ artifacts: paths: - built-packages/* @@ -50,8 +50,8 @@ build-amd64-ubuntu-bionic: image: ubuntu:bionic script: - ./gitlab-build.sh - - mkdir -p built-packages/ubuntu_bionic/ - - mv ../*.deb built-packages/ubuntu_bionic/ + - mkdir -p built-packages/bionic/ + - mv ../*.deb built-packages/bionic/ artifacts: paths: - built-packages/* @@ -64,8 +64,8 @@ build-amd64-ubuntu-cosmic: image: ubuntu:cosmic script: - ./gitlab-build.sh - - mkdir -p built-packages/ubuntu_cosmic/ - - mv ../*.deb built-packages/ubuntu_cosmic/ + - mkdir -p built-packages/cosmic/ + - mv ../*.deb built-packages/cosmic/ artifacts: paths: - built-packages/* @@ -133,7 +133,7 @@ run-unit-tests-ubuntu-xenial: stage: test image: ubuntu:xenial script: - - ./run-tests.sh ubuntu_xenial + - ./run-tests.sh xenial only: - tags @@ -141,7 +141,7 @@ run-unit-tests-ubuntu-bionic: stage: test image: ubuntu:bionic script: - - ./run-tests.sh ubuntu_bionic + - ./run-tests.sh bionic only: - tags @@ -149,7 +149,7 @@ run-unit-tests-ubuntu-cosmic: stage: test image: ubuntu:cosmic script: - - ./run-tests.sh ubuntu_cosmic + - ./run-tests.sh cosmic only: - tags @@ -157,7 +157,7 @@ run-unit-tests-debian-stretch: stage: test image: debian:stretch script: - - ./run-tests.sh debian_stretch + - ./run-tests.sh stretch only: - tags @@ -165,7 +165,7 @@ run-unit-tests-debian-jessie: stage: test image: debian:jessie script: - - ./run-tests.sh debian_jessie + - ./run-tests.sh jessie only: - tags diff --git a/bintray-upload.sh b/bintray-upload.sh index 523d8de..2e136b6 100755 --- a/bintray-upload.sh +++ b/bintray-upload.sh @@ -4,7 +4,7 @@ set -e -o pipefail BINTRAY_DEB_REPO="wand/general" BINTRAY_RPM_REPO="wand/general-rpm" -BINTRAY_LICENSE="LGPL-3" +BINTRAY_LICENSE="LGPL-3.0" apt-get update && apt-get install -y curl util-linux From f17e7dd3597fd409cfba46fc4fdff109ad8e0d03 Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Thu, 9 May 2019 17:17:54 +1200 Subject: [PATCH 11/20] Avoid auto-updating debian changelog for re-packaging. This will stop us from creating new bintray version entries whenever we're just testing the packaging environment. --- gitlab-build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitlab-build.sh b/gitlab-build.sh index 3ee6283..a510fda 100755 --- a/gitlab-build.sh +++ b/gitlab-build.sh @@ -6,6 +6,8 @@ export DEBEMAIL='packaging@wand.net.nz' export DEBFULLNAME='WAND Packaging' export DEBIAN_FRONTEND=noninteractive +SOURCENAME=`echo ${CI_COMMIT_REF_NAME} | cut -d '-' -f 1` + apt-get update apt-get install -y equivs devscripts dpkg-dev quilt curl apt-transport-https \ apt-utils ssl-cert ca-certificates gnupg lsb-release debhelper git @@ -19,6 +21,6 @@ chmod 644 /etc/apt/trusted.gpg.d/wand.gpg apt-get update -dpkg-parsechangelog -S version | grep -q ${CI_COMMIT_REF_NAME} || debchange --newversion ${CI_COMMIT_REF_NAME} -b "New upstream release" +dpkg-parsechangelog -S version | grep -q ${SOURCENAME} || debchange --newversion ${SOURCENAME} -b "New upstream release" mk-build-deps -i -r -t 'apt-get -f -y --force-yes' dpkg-buildpackage -b -us -uc -rfakeroot -j4 From 5dfb63042e52043a46b9c795ffb1b78e16ef2068 Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Thu, 9 May 2019 17:59:01 +1200 Subject: [PATCH 12/20] Add quotes to pkg_dist variable --- bintray-upload.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bintray-upload.sh b/bintray-upload.sh index 2e136b6..e09d9cb 100755 --- a/bintray-upload.sh +++ b/bintray-upload.sh @@ -44,7 +44,7 @@ for path in `find built-packages/ -maxdepth 1 -type d`; do pkg_name=`echo ${rev_filename} | cut -d '-' -f4- | rev` pkg_version=`echo ${rev_filename} | cut -d '-' -f1-3 | rev | cut -d '.' -f1-3` pkg_arch=`echo ${rev_filename} | cut -d '-' -f1 | rev | cut -d '.' -f1` - pkg_dist=centos + pkg_dist="centos" pkg_rel=`echo ${rev_filename} | cut -d '.' -f2 | rev | cut -d '-' -f 1` if [ "$pkg_rel" = "el6" ]; then @@ -60,7 +60,7 @@ for path in `find built-packages/ -maxdepth 1 -type d`; do pkg_name=`echo ${rev_filename} | cut -d '-' -f3- | rev` pkg_version=`echo ${rev_filename} | cut -d '-' -f1-2 | rev | cut -d '.' -f1-3` pkg_arch=`echo ${rev_filename} | cut -d '.' -f2 | rev` - pkg_dist=fedora + pkg_dist="fedora" pkg_rel=`echo ${rev_filename} | cut -d '.' -f3 | rev` releasever="${pkg_rel:2}" fi From 80196fc1f4514b5487b8e651d254d618bd544fb2 Mon Sep 17 00:00:00 2001 From: Alistair King Date: Thu, 9 May 2019 09:52:32 -0700 Subject: [PATCH 13/20] Set HTTP User Agent to `wandio/` --- lib/ior-http.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ior-http.c b/lib/ior-http.c index e6dbb62..752b65a 100644 --- a/lib/ior-http.c +++ b/lib/ior-http.c @@ -275,6 +275,7 @@ io_t *init_io(io_t *io) { curl_easy_setopt(DATA(io)->curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(DATA(io)->curl, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_setopt(DATA(io)->curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(DATA(io)->curl, CURLOPT_USERAGENT, "wandio/"VERSION); /* for remote files, the buffer set to 2*CURL_MAX_WRITE_SIZE */ DATA(io)->m_buf = CURL_MAX_WRITE_SIZE * 2; From a50bff7c100f8d788c093bcf9b99e23f5fb9c593 Mon Sep 17 00:00:00 2001 From: Alistair King Date: Thu, 9 May 2019 14:15:02 -0700 Subject: [PATCH 14/20] Better libCURL error handling Previously most libcurl errors were ignored which meant that common failures would look like empty files. This adds better error checking and prints a (hopefully) helpful error message when something goes wrong. This commit also removes the terribly unsafe SSL settings that told libCURL to not bother verifying the SSL certs in an HTTPS connection. A side effect of this is that wandio will now refuse to read from a server with self-signed certs. --- lib/ior-http.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/lib/ior-http.c b/lib/ior-http.c index e6dbb62..1e51b8e 100644 --- a/lib/ior-http.c +++ b/lib/ior-http.c @@ -156,7 +156,9 @@ static int fill_buffer(io_t *io) { struct timeval to; // the following is adaped from docs/examples/fopen.c to.tv_sec = 10, to.tv_usec = 0; // 10 seconds - curl_multi_timeout(DATA(io)->multi, &curl_to); + if (curl_multi_timeout(DATA(io)->multi, &curl_to) != CURLM_OK) { + return -1; + } if (curl_to >= 0) { to.tv_sec = curl_to / 1000; if (to.tv_sec > 1) @@ -168,8 +170,10 @@ static int fill_buffer(io_t *io) { FD_ZERO(&fdw); FD_ZERO(&fde); - /* FIXME: check return code */ - curl_multi_fdset(DATA(io)->multi, &fdr, &fdw, &fde, &maxfd); + if (curl_multi_fdset(DATA(io)->multi, &fdr, &fdw, &fde, + &maxfd) != CURLM_OK) { + return -1; + } if (maxfd >= 0 && (rc = select(maxfd + 1, &fdr, &fdw, &fde, &to)) < 0) break; @@ -182,8 +186,10 @@ static int fill_buffer(io_t *io) { nanosleep(&req, &rem); } curl_easy_pause(DATA(io)->curl, CURLPAUSE_CONT); - /* FIXME: check return code */ - rc = curl_multi_perform(DATA(io)->multi, &n_running); + if (curl_multi_perform(DATA(io)->multi, &n_running) != + CURLM_OK) { + return -1; + } if (DATA(io)->total_length < 0) { // update file length. double cl; @@ -195,6 +201,21 @@ static int fill_buffer(io_t *io) { } while (n_running && DATA(io)->l_buf < DATA(io)->m_buf - CURL_MAX_WRITE_SIZE); + // check if there were any errors from curl + struct CURLMsg *m = NULL; + do { + int msgq = 0; + m = curl_multi_info_read(DATA(io)->multi, &msgq); + if (m != NULL && m->data.result != CURLE_OK) { + // there was an error reading -- if this is the first + // read, then the wandio_create call will fail. + fprintf(stderr, "HTTP ERROR: %s (%d)\n", + curl_easy_strerror(m->data.result), + m->data.result); + return -1; + } + } while (m != NULL); + if (DATA(io)->l_buf < DATA(io)->m_buf - CURL_MAX_WRITE_SIZE) { if (DATA(io)->off0 + DATA(io)->p_buf >= DATA(io)->total_length) { @@ -272,8 +293,8 @@ io_t *init_io(io_t *io) { curl_easy_setopt(DATA(io)->curl, CURLOPT_VERBOSE, 0L); curl_easy_setopt(DATA(io)->curl, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt(DATA(io)->curl, CURLOPT_WRITEFUNCTION, write_cb); - curl_easy_setopt(DATA(io)->curl, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(DATA(io)->curl, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(DATA(io)->curl, CURLOPT_SSL_VERIFYPEER, 1L); + curl_easy_setopt(DATA(io)->curl, CURLOPT_SSL_VERIFYHOST, 1L); curl_easy_setopt(DATA(io)->curl, CURLOPT_FOLLOWLOCATION, 1L); /* for remote files, the buffer set to 2*CURL_MAX_WRITE_SIZE */ From 92e8ff6d10ad6f63f4ee70b02e9dd390c4ff535f Mon Sep 17 00:00:00 2001 From: Alistair King Date: Thu, 9 May 2019 14:23:04 -0700 Subject: [PATCH 15/20] Change wandiocat to return number of failed files Previously wandiocat always returned 0. This changes the return code to be the number of files that failed to open for some reason. --- tools/wandiocat/wcat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/wandiocat/wcat.c b/tools/wandiocat/wcat.c index bda7b17..6bca4ae 100644 --- a/tools/wandiocat/wcat.c +++ b/tools/wandiocat/wcat.c @@ -101,6 +101,7 @@ int main(int argc, char *argv[]) { iow_t *iow = wandio_wcreate(output, compress_type, compress_level, 0); /* stdout */ int i; + int rc = 0; #if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 if (posix_memalign((void **)&buffer, 4096, WANDIO_BUFFER_SIZE) != 0) { @@ -117,6 +118,7 @@ int main(int argc, char *argv[]) { io_t *ior = wandio_create(argv[i]); if (!ior) { fprintf(stderr, "Failed to open %s\n", argv[i]); + rc++; continue; } @@ -131,5 +133,5 @@ int main(int argc, char *argv[]) { } free(buffer); wandio_wdestroy(iow); - return 0; + return rc; } From f2cfb45b7f5c1a145260217033d870544f394c75 Mon Sep 17 00:00:00 2001 From: Alistair King Date: Thu, 9 May 2019 15:34:54 -0700 Subject: [PATCH 16/20] Switch from `VERSION` to `PACKAGE_VERSION` --- lib/ior-http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ior-http.c b/lib/ior-http.c index 752b65a..97e1349 100644 --- a/lib/ior-http.c +++ b/lib/ior-http.c @@ -275,7 +275,7 @@ io_t *init_io(io_t *io) { curl_easy_setopt(DATA(io)->curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(DATA(io)->curl, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_setopt(DATA(io)->curl, CURLOPT_FOLLOWLOCATION, 1L); - curl_easy_setopt(DATA(io)->curl, CURLOPT_USERAGENT, "wandio/"VERSION); + curl_easy_setopt(DATA(io)->curl, CURLOPT_USERAGENT, "wandio/"PACKAGE_VERSION); /* for remote files, the buffer set to 2*CURL_MAX_WRITE_SIZE */ DATA(io)->m_buf = CURL_MAX_WRITE_SIZE * 2; From d0f8c306de8055f11f819b37ab95790a756461e6 Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Fri, 10 May 2019 11:39:50 +1200 Subject: [PATCH 17/20] Fix stupidly broken bintray_upload script for RPMs The previous version of this only ever worked through good fortune rather than good scripting, which is why it broke terribly when I decided to restructure the repository --- bintray-upload.sh | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/bintray-upload.sh b/bintray-upload.sh index e09d9cb..ffac3ff 100755 --- a/bintray-upload.sh +++ b/bintray-upload.sh @@ -39,32 +39,22 @@ for path in `find built-packages/ -maxdepth 1 -type d`; do if [ "$ext" = "rpm" ]; then rev_filename=`echo ${pkg_filename} | rev` - if [[ "$1" =~ centos_* ]]; then + if [[ ${linux_version} =~ centos_* ]]; then # centos - pkg_name=`echo ${rev_filename} | cut -d '-' -f4- | rev` - pkg_version=`echo ${rev_filename} | cut -d '-' -f1-3 | rev | cut -d '.' -f1-3` - pkg_arch=`echo ${rev_filename} | cut -d '-' -f1 | rev | cut -d '.' -f1` pkg_dist="centos" - pkg_rel=`echo ${rev_filename} | cut -d '.' -f2 | rev | cut -d '-' -f 1` - - if [ "$pkg_rel" = "el6" ]; then - releasever=6 - elif [ "$pkg_rel" = "el7" ]; then - releasever=7 - else - releasever=unknown - fi else # fedora - pkg_name=`echo ${rev_filename} | cut -d '-' -f3- | rev` - pkg_version=`echo ${rev_filename} | cut -d '-' -f1-2 | rev | cut -d '.' -f1-3` - pkg_arch=`echo ${rev_filename} | cut -d '.' -f2 | rev` pkg_dist="fedora" - pkg_rel=`echo ${rev_filename} | cut -d '.' -f3 | rev` - releasever="${pkg_rel:2}" fi + pkg_name=`echo ${rev_filename} | cut -d '-' -f3- | rev` + pkg_version=`echo ${rev_filename} | cut -d '-' -f1-2 | rev | cut -d '.' -f1-3` + pkg_arch=`echo ${rev_filename} | cut -d '.' -f2 | rev` + pkg_rel=`echo ${rev_filename} | cut -d '.' -f3 | rev` + releasever="${pkg_rel:2}" + + jfrog bt package-create --licenses ${BINTRAY_LICENSE} --vcs-url ${CI_PROJECT_URL} ${BINTRAY_RPM_REPO}/${pkg_name} || true jfrog bt upload ${deb} ${BINTRAY_RPM_REPO}/${pkg_name}/${pkg_version} ${pkg_dist}/${releasever}/${pkg_arch}/ From 8c563af273c3842bfae1c0b3ab65fa7e6d90f2db Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Fri, 10 May 2019 13:35:14 +1200 Subject: [PATCH 18/20] Increase version to 4.2.0, pending release The replacing of 'off_t' with 'int64_t' in the newer API functions means we had to increment the mid-number in the version. --- ChangeLog | 8 ++++++++ README | 2 +- configure.ac | 6 +++--- debian/changelog | 10 ++++++++++ lib/Makefile.am | 2 +- rpm/libwandio1.spec | 8 ++++---- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa8de4e..5ee1648 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Version 4.2.0 +============= + * Include wandio version number in the HTTP user-agent + * Improved error detection and handling when reading HTTP + * Replaced 'off_t' parameters and return values with 'int64_t' in + recently added API functions. + * Fixed potential uninitialised memory error when closing a wandio writer. + Version 4.1.2 ============= * Fix buffer overflow bug in the swift reading code (thanks Alistair). diff --git a/README b/README index b778cac..314dc05 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -WANDIO 4.1.2 +WANDIO 4.2.0 --------------------------------------------------------------------------- Copyright (c) 2007-2019 The University of Waikato, Hamilton, New Zealand. diff --git a/configure.ac b/configure.ac index ae9d764..691b100 100644 --- a/configure.ac +++ b/configure.ac @@ -3,11 +3,11 @@ # Now you only need to update the version number in two places - below, # and in the README -AC_INIT([wandio],[4.1.2],[contact@wand.net.nz],[wandio]) +AC_INIT([wandio],[4.2.0],[contact@wand.net.nz],[wandio]) WANDIO_MAJOR=4 -WANDIO_MID=1 -WANDIO_MINOR=2 +WANDIO_MID=2 +WANDIO_MINOR=0 # OpenSolaris hides libraries like libncurses in /usr/gnu/lib, which is not # searched by default - add it to LDFLAGS so we at least have a chance of diff --git a/debian/changelog b/debian/changelog index 3fba6fb..5d8c657 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +libwandio1 (4.2.0) unstable; urgency=medium + + * Include wandio version number in the HTTP user-agent + * Improved error detection and handling when reading HTTP + * Replaced 'off_t' parameters and return values with 'int64_t' in + recently added API functions. + * Fixed potential uninitialised memory error when closing a wandio writer. + + -- Shane Alcock Fri, 10 May 2019 13:31:49 +1200 + libwandio1 (4.1.2-1) unstable; urgency=medium * Fix swift buffer overflow bug diff --git a/lib/Makefile.am b/lib/Makefile.am index 16bb1bc..bd845c5 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -73,5 +73,5 @@ libwandio_la_SOURCES=wandio.c ior-peek.c ior-stdio.c ior-thread.c \ AM_CPPFLAGS = @ADD_INCLS@ libwandio_la_LIBADD = @LIBWANDIO_LIBS@ -libwandio_la_LDFLAGS=-version-info 5:2:1 @ADD_LDFLAGS@ +libwandio_la_LDFLAGS=-version-info 6:0:0 @ADD_LDFLAGS@ diff --git a/rpm/libwandio1.spec b/rpm/libwandio1.spec index a16bd65..f256b2a 100644 --- a/rpm/libwandio1.spec +++ b/rpm/libwandio1.spec @@ -1,6 +1,6 @@ Name: libwandio1 -Version: 4.1.2 -Release: 2%{?dist} +Version: 4.2.0 +Release: 1%{?dist} Summary: C Multi-Threaded File Compression and Decompression Library License: LGPLv3 @@ -73,8 +73,8 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' %{_bindir}/wandiocat %changelog -* Thu May 09 2019 Shane Alcock - 4.1.2-2 -- Re-built packages for new repository layout +* Fri May 10 2019 Shane Alcock - 4.2.0-1 +- New upstream release (4.2.0) * Thu Feb 21 2019 Shane Alcock - 4.1.0-1 - First libwandio package From da8f26ec00f3ee3dddcf05bbfc814ff2e74f4664 Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Fri, 10 May 2019 13:54:19 +1200 Subject: [PATCH 19/20] Forgot to add "-1" to the version in the debian changelog :/ --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 5d8c657..b28c12d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -libwandio1 (4.2.0) unstable; urgency=medium +libwandio1 (4.2.0-1) unstable; urgency=medium * Include wandio version number in the HTTP user-agent * Improved error detection and handling when reading HTTP From f418ca0ec03f02b3123ab543cdf6805299d141e3 Mon Sep 17 00:00:00 2001 From: Shane Alcock Date: Mon, 13 May 2019 13:36:23 +1200 Subject: [PATCH 20/20] Add DLLEXPORT to a *_open and *_wopen functions These functions were already in the wandio.h header and some users would like to access them (the HTTP ones, in particular), directly without the extra wandio overhead. Without DLLEXPORT, the symbols are only available internally so this commit fixes that. Long term, we need to re-evaluate the structure of wandio and how things should be arranged / made available to best suit the modern use cases that people have for it. --- ChangeLog | 1 + debian/changelog | 1 + lib/ior-bzip.c | 2 +- lib/ior-http.c | 5 +++-- lib/ior-lzma.c | 2 +- lib/ior-peek.c | 2 +- lib/ior-qat.c | 2 +- lib/ior-stdio.c | 2 +- lib/ior-swift.c | 2 +- lib/ior-thread.c | 2 +- lib/ior-zlib.c | 2 +- lib/ior-zstd-lz4.c | 2 +- lib/iow-bzip.c | 2 +- lib/iow-lz4.c | 2 +- lib/iow-lzma.c | 2 +- lib/iow-lzo.c | 2 +- lib/iow-qat.c | 2 +- lib/iow-stdio.c | 2 +- lib/iow-thread.c | 2 +- lib/iow-zlib.c | 2 +- lib/iow-zstd.c | 2 +- 21 files changed, 23 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ee1648..1f645cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ Version 4.2.0 * Replaced 'off_t' parameters and return values with 'int64_t' in recently added API functions. * Fixed potential uninitialised memory error when closing a wandio writer. + * Export symbols for all format-specific open functions. Version 4.1.2 ============= diff --git a/debian/changelog b/debian/changelog index b28c12d..67f5cb7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ libwandio1 (4.2.0-1) unstable; urgency=medium * Replaced 'off_t' parameters and return values with 'int64_t' in recently added API functions. * Fixed potential uninitialised memory error when closing a wandio writer. + * Export symbols for all format-specific 'open' functions. -- Shane Alcock Fri, 10 May 2019 13:31:49 +1200 diff --git a/lib/ior-bzip.c b/lib/ior-bzip.c index e935826..5afabf2 100644 --- a/lib/ior-bzip.c +++ b/lib/ior-bzip.c @@ -51,7 +51,7 @@ extern io_source_t bz_source; #define DATA(io) ((struct bz_t *)((io)->data)) #define min(a, b) ((a) < (b) ? (a) : (b)) -io_t *bz_open(io_t *parent) { +DLLEXPORT io_t *bz_open(io_t *parent) { io_t *io; if (!parent) return NULL; diff --git a/lib/ior-http.c b/lib/ior-http.c index 863a83a..e88a1b6 100644 --- a/lib/ior-http.c +++ b/lib/ior-http.c @@ -240,7 +240,8 @@ static int fill_buffer(io_t *io) { return DATA(io)->l_buf; } -io_t *http_open_hdrs(const char *filename, char **hdrs, int hdrs_cnt) { +DLLEXPORT io_t *http_open_hdrs(const char *filename, char **hdrs, int hdrs_cnt) +{ io_t *io = malloc(sizeof(io_t)); if (!io) return NULL; @@ -270,7 +271,7 @@ io_t *http_open_hdrs(const char *filename, char **hdrs, int hdrs_cnt) { return io; } -io_t *http_open(const char *filename) { +DLLEXPORT io_t *http_open(const char *filename) { return http_open_hdrs(filename, NULL, 0); } diff --git a/lib/ior-lzma.c b/lib/ior-lzma.c index edf6a98..b53c98d 100644 --- a/lib/ior-lzma.c +++ b/lib/ior-lzma.c @@ -51,7 +51,7 @@ extern io_source_t lzma_source; #define DATA(io) ((struct lzma_t *)((io)->data)) #define min(a, b) ((a) < (b) ? (a) : (b)) -io_t *lzma_open(io_t *parent) { +DLLEXPORT io_t *lzma_open(io_t *parent) { io_t *io; if (!parent) return NULL; diff --git a/lib/ior-peek.c b/lib/ior-peek.c index 1477cf0..812a0b4 100644 --- a/lib/ior-peek.c +++ b/lib/ior-peek.c @@ -65,7 +65,7 @@ extern io_source_t peek_source; #define DATA(io) ((struct peek_t *)((io)->data)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) -io_t *peek_open(io_t *child) { +DLLEXPORT io_t *peek_open(io_t *child) { io_t *io; if (!child) return NULL; diff --git a/lib/ior-qat.c b/lib/ior-qat.c index 74433bf..d703898 100644 --- a/lib/ior-qat.c +++ b/lib/ior-qat.c @@ -80,7 +80,7 @@ struct qat_t { enum err_t err; }; -io_t *qat_open(io_t *parent) { +DLLEXPORT io_t *qat_open(io_t *parent) { int x; io_t *io; diff --git a/lib/ior-stdio.c b/lib/ior-stdio.c index 2b507b0..b38d049 100644 --- a/lib/ior-stdio.c +++ b/lib/ior-stdio.c @@ -46,7 +46,7 @@ extern io_source_t stdio_source; #define DATA(io) ((struct stdio_t *)((io)->data)) -io_t *stdio_open(const char *filename) { +DLLEXPORT io_t *stdio_open(const char *filename) { io_t *io = malloc(sizeof(io_t)); io->data = malloc(sizeof(struct stdio_t)); diff --git a/lib/ior-swift.c b/lib/ior-swift.c index 86cff70..727af4b 100644 --- a/lib/ior-swift.c +++ b/lib/ior-swift.c @@ -65,7 +65,7 @@ extern io_source_t swift_source; #define SWIFT_PFX_LEN 8 #define SWIFT_AUTH_TOKEN_HDR "X-Auth-Token: " -io_t *swift_open(const char *filename); +DLLEXPORT io_t *swift_open(const char *filename); static int64_t swift_read(io_t *io, void *buffer, int64_t len); static int64_t swift_tell(io_t *io); static int64_t swift_seek(io_t *io, int64_t offset, int whence); diff --git a/lib/ior-thread.c b/lib/ior-thread.c index 0ad2cdf..a9710fa 100644 --- a/lib/ior-thread.c +++ b/lib/ior-thread.c @@ -152,7 +152,7 @@ static void *thread_producer(void *userdata) { return NULL; } -io_t *thread_open(io_t *parent) { +DLLEXPORT io_t *thread_open(io_t *parent) { io_t *state; sigset_t set; int s; diff --git a/lib/ior-zlib.c b/lib/ior-zlib.c index d1fdb14..cc23406 100644 --- a/lib/ior-zlib.c +++ b/lib/ior-zlib.c @@ -53,7 +53,7 @@ extern io_source_t zlib_source; #define DATA(io) ((struct zlib_t *)((io)->data)) #define min(a, b) ((a) < (b) ? (a) : (b)) -io_t *zlib_open(io_t *parent) { +DLLEXPORT io_t *zlib_open(io_t *parent) { io_t *io; if (!parent) return NULL; diff --git a/lib/ior-zstd-lz4.c b/lib/ior-zstd-lz4.c index a83a809..629e1eb 100644 --- a/lib/ior-zstd-lz4.c +++ b/lib/ior-zstd-lz4.c @@ -64,7 +64,7 @@ struct zstd_lz4_t { #define DATA(io) ((struct zstd_lz4_t *)((io)->data)) extern io_source_t zstd_lz4_source; -io_t *zstd_lz4_open(io_t *parent) { +DLLEXPORT io_t *zstd_lz4_open(io_t *parent) { io_t *io; if (!parent) { return NULL; diff --git a/lib/iow-bzip.c b/lib/iow-bzip.c index ff70162..b9ec543 100644 --- a/lib/iow-bzip.c +++ b/lib/iow-bzip.c @@ -50,7 +50,7 @@ extern iow_source_t bz_wsource; #define DATA(iow) ((struct bzw_t *)((iow)->data)) #define min(a, b) ((a) < (b) ? (a) : (b)) -iow_t *bz_wopen(iow_t *child, int compress_level) { +DLLEXPORT iow_t *bz_wopen(iow_t *child, int compress_level) { iow_t *iow; if (!child) return NULL; diff --git a/lib/iow-lz4.c b/lib/iow-lz4.c index 6578f1c..3648942 100644 --- a/lib/iow-lz4.c +++ b/lib/iow-lz4.c @@ -54,7 +54,7 @@ struct lz4w_t { #define DATA(iow) ((struct lz4w_t *)((iow)->data)) extern iow_source_t lz4_wsource; -iow_t *lz4_wopen(iow_t *child, int compress_level) { +DLLEXPORT iow_t *lz4_wopen(iow_t *child, int compress_level) { iow_t *iow; if (!child) { return NULL; diff --git a/lib/iow-lzma.c b/lib/iow-lzma.c index 35979a6..1c93afd 100644 --- a/lib/iow-lzma.c +++ b/lib/iow-lzma.c @@ -51,7 +51,7 @@ extern iow_source_t lzma_wsource; #define DATA(iow) ((struct lzmaw_t *)((iow)->data)) #define min(a, b) ((a) < (b) ? (a) : (b)) -iow_t *lzma_wopen(iow_t *child, int compress_level) { +DLLEXPORT iow_t *lzma_wopen(iow_t *child, int compress_level) { iow_t *iow; if (!child) return NULL; diff --git a/lib/iow-lzo.c b/lib/iow-lzo.c index 54110b4..9db05c0 100644 --- a/lib/iow-lzo.c +++ b/lib/iow-lzo.c @@ -265,7 +265,7 @@ static void *lzo_compress_thread(void *data) { return NULL; } -iow_t *lzo_wopen(iow_t *child, int compress_level) { +DLLEXPORT iow_t *lzo_wopen(iow_t *child, int compress_level) { const int opt_filter = 0; int flags; iow_t *iow; diff --git a/lib/iow-qat.c b/lib/iow-qat.c index 798b393..a2110aa 100644 --- a/lib/iow-qat.c +++ b/lib/iow-qat.c @@ -79,7 +79,7 @@ static void qat_perror(int errcode) { } } -iow_t *qat_wopen(iow_t *child, int compress_level) { +DLLEXPORT iow_t *qat_wopen(iow_t *child, int compress_level) { iow_t *iow; QzSessionParams_T params; diff --git a/lib/iow-stdio.c b/lib/iow-stdio.c index 934a224..2858943 100644 --- a/lib/iow-stdio.c +++ b/lib/iow-stdio.c @@ -96,7 +96,7 @@ static int safe_open(const char *filename, int flags) { return fd; } -iow_t *stdio_wopen(const char *filename, int flags) { +DLLEXPORT iow_t *stdio_wopen(const char *filename, int flags) { iow_t *iow = malloc(sizeof(iow_t)); iow->source = &stdio_wsource; iow->data = malloc(sizeof(struct stdiow_t)); diff --git a/lib/iow-thread.c b/lib/iow-thread.c index d045331..a409bb6 100644 --- a/lib/iow-thread.c +++ b/lib/iow-thread.c @@ -150,7 +150,7 @@ static void *thread_consumer(void *userdata) { return NULL; } -iow_t *thread_wopen(iow_t *child) { +DLLEXPORT iow_t *thread_wopen(iow_t *child) { iow_t *state; if (!child) { diff --git a/lib/iow-zlib.c b/lib/iow-zlib.c index 50bca06..3c7e0d6 100644 --- a/lib/iow-zlib.c +++ b/lib/iow-zlib.c @@ -51,7 +51,7 @@ extern iow_source_t zlib_wsource; #define DATA(iow) ((struct zlibw_t *)((iow)->data)) #define min(a, b) ((a) < (b) ? (a) : (b)) -iow_t *zlib_wopen(iow_t *child, int compress_level) { +DLLEXPORT iow_t *zlib_wopen(iow_t *child, int compress_level) { iow_t *iow; if (!child) return NULL; diff --git a/lib/iow-zstd.c b/lib/iow-zstd.c index 6586cb7..45680fb 100644 --- a/lib/iow-zstd.c +++ b/lib/iow-zstd.c @@ -46,7 +46,7 @@ struct zstdw_t { #define DATA(iow) ((struct zstdw_t *)((iow)->data)) extern iow_source_t zstd_wsource; -iow_t *zstd_wopen(iow_t *child, int compress_level) { +DLLEXPORT iow_t *zstd_wopen(iow_t *child, int compress_level) { iow_t *iow; if (!child) return NULL;