From 5df063677b9923103dca16f7eee92b474a142250 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 4 Mar 2021 11:00:46 +0100 Subject: [PATCH 1/7] main: check for asprintf return code Signed-off-by: Giuseppe Scrivano --- main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 8f0697a..cb9350b 100644 --- a/main.c +++ b/main.c @@ -1398,7 +1398,7 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c ret = calloc (1, sizeof (*ret)); if (ret == NULL) - return NULL; + return NULL; ret->parent = parent; ret->layer = layer; @@ -5423,7 +5423,11 @@ load_default_plugins () if (dent->d_type != DT_DIR) { char *new_plugins = NULL; - asprintf (&new_plugins, "%s/%s:%s", PKGLIBEXECDIR, dent->d_name, plugins); + if (asprintf (&new_plugins, "%s/%s:%s", PKGLIBEXECDIR, dent->d_name, plugins) < 0) + { + free (plugins); + return NULL; + } free (plugins); plugins = new_plugins; } From 446e99e4c61ba6eb8538ac3af282983e7caa1629 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 4 Mar 2021 11:02:03 +0100 Subject: [PATCH 2/7] utils: fix double definition for _GNU_SOURCE Signed-off-by: Giuseppe Scrivano --- utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils.h b/utils.h index bb2183c..13a177e 100644 --- a/utils.h +++ b/utils.h @@ -18,7 +18,9 @@ #ifndef UTILS_H # define UTILS_H +#ifndef _GNU_SOURCE # define _GNU_SOURCE +#endif # include From 360a0c6bfd00e382e96956099d2b4770acbc926d Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 4 Mar 2021 11:02:37 +0100 Subject: [PATCH 3/7] main: drop unused variable Signed-off-by: Giuseppe Scrivano --- main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/main.c b/main.c index cb9350b..0117e15 100644 --- a/main.c +++ b/main.c @@ -1562,7 +1562,6 @@ static struct ovl_node * insert_node (struct ovl_node *parent, struct ovl_node *item, bool replace) { struct ovl_node *old = NULL, *prev_parent = item->parent; - int is_dir = node_dirp (item); int ret; if (prev_parent) From c1fd9a7e0b6ff78c8faf73a7e8960bf98d14cbc1 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 4 Mar 2021 11:03:14 +0100 Subject: [PATCH 4/7] main: ignore write error Signed-off-by: Giuseppe Scrivano --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 0117e15..5731085 100644 --- a/main.c +++ b/main.c @@ -179,7 +179,7 @@ print_stats (int sig) char fmt[128]; int l = snprintf (fmt, sizeof (fmt) - 1, "# INODES: %zu\n# NODES: %zu\n", stats.inodes, stats.nodes); fmt[l] = '\0'; - write (STDERR_FILENO, fmt, l + 1); + (void) write (STDERR_FILENO, fmt, l + 1); } static double From 44561349cdbda57816c05ef48540b5b42ba52913 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 4 Mar 2021 11:04:48 +0100 Subject: [PATCH 5/7] main: use strncpy instead of strcpy Signed-off-by: Giuseppe Scrivano --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 5731085..1cad322 100644 --- a/main.c +++ b/main.c @@ -5021,7 +5021,7 @@ do_fsync (fuse_req_t req, fuse_ino_t ino, int datasync, int fd) } if (fd < 0) - strcpy (path, node->path); + strncpy (path, node->path, PATH_MAX); if (! do_fsync) { From 95a0a8999b523430e392c8b80cbb2dfca067068b Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 4 Mar 2021 11:45:22 +0100 Subject: [PATCH 6/7] tests: install ffjson Signed-off-by: Giuseppe Scrivano --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d2bbc0e..823b903 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -64,6 +64,7 @@ jobs: sudo mkdir -p /lower /upper /mnt sudo sh -c "(cd /; git clone https://github.com/amir73il/unionmount-testsuite.git)" sudo go get github.com/containers/storage + sudo GOPATH=$GOPATH sh -c "(cd /root/go/src/github.com/containers/storage; make tests/tools/build/ffjson; cp tests/tools/build/ffjson /usr/bin)" sudo GOPATH=$GOPATH sh -c "(cd /root/go/src/github.com/containers/storage; sed -i -e 's|^AUTOTAGS.*$|AUTOTAGS := exclude_graphdriver_devicemapper exclude_graphdriver_btrfs|' Makefile; make GO111MODULE=on containers-storage)" - name: run autogen.sh From 5530c154d814eb93794c0394772893749df9a71c Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 4 Mar 2021 12:00:12 +0100 Subject: [PATCH 7/7] tests: fix test Signed-off-by: Giuseppe Scrivano --- tests/fedora-installs.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/fedora-installs.sh b/tests/fedora-installs.sh index bbde865..eaf7d93 100755 --- a/tests/fedora-installs.sh +++ b/tests/fedora-installs.sh @@ -207,7 +207,7 @@ sleep_pid=$! rm merged/toremove grep 12345 /proc/$sleep_pid/fd/0 -RUN touch merged/a merged/b -RUN chmod 6 merged/a -RUN mv merged/a merged/x -RUN mv merged/b merged/a +touch merged/a merged/b +chmod 6 merged/a +mv merged/a merged/x +mv merged/b merged/a