mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-07 06:08:54 -04:00
Merge pull request #278 from giuseppe/fix-static-analysis
src: fix some defects found by static analysis
This commit is contained in:
commit
d085fa9ade
1
.github/workflows/test.yaml
vendored
1
.github/workflows/test.yaml
vendored
@ -64,6 +64,7 @@ jobs:
|
|||||||
sudo mkdir -p /lower /upper /mnt
|
sudo mkdir -p /lower /upper /mnt
|
||||||
sudo sh -c "(cd /; git clone https://github.com/amir73il/unionmount-testsuite.git)"
|
sudo sh -c "(cd /; git clone https://github.com/amir73il/unionmount-testsuite.git)"
|
||||||
sudo go get github.com/containers/storage
|
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)"
|
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
|
- name: run autogen.sh
|
||||||
|
13
main.c
13
main.c
@ -179,7 +179,7 @@ print_stats (int sig)
|
|||||||
char fmt[128];
|
char fmt[128];
|
||||||
int l = snprintf (fmt, sizeof (fmt) - 1, "# INODES: %zu\n# NODES: %zu\n", stats.inodes, stats.nodes);
|
int l = snprintf (fmt, sizeof (fmt) - 1, "# INODES: %zu\n# NODES: %zu\n", stats.inodes, stats.nodes);
|
||||||
fmt[l] = '\0';
|
fmt[l] = '\0';
|
||||||
write (STDERR_FILENO, fmt, l + 1);
|
(void) write (STDERR_FILENO, fmt, l + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static double
|
static double
|
||||||
@ -1398,7 +1398,7 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c
|
|||||||
|
|
||||||
ret = calloc (1, sizeof (*ret));
|
ret = calloc (1, sizeof (*ret));
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret->parent = parent;
|
ret->parent = parent;
|
||||||
ret->layer = layer;
|
ret->layer = layer;
|
||||||
@ -1562,7 +1562,6 @@ static struct ovl_node *
|
|||||||
insert_node (struct ovl_node *parent, struct ovl_node *item, bool replace)
|
insert_node (struct ovl_node *parent, struct ovl_node *item, bool replace)
|
||||||
{
|
{
|
||||||
struct ovl_node *old = NULL, *prev_parent = item->parent;
|
struct ovl_node *old = NULL, *prev_parent = item->parent;
|
||||||
int is_dir = node_dirp (item);
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (prev_parent)
|
if (prev_parent)
|
||||||
@ -5022,7 +5021,7 @@ do_fsync (fuse_req_t req, fuse_ino_t ino, int datasync, int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
strcpy (path, node->path);
|
strncpy (path, node->path, PATH_MAX);
|
||||||
|
|
||||||
if (! do_fsync)
|
if (! do_fsync)
|
||||||
{
|
{
|
||||||
@ -5423,7 +5422,11 @@ load_default_plugins ()
|
|||||||
if (dent->d_type != DT_DIR)
|
if (dent->d_type != DT_DIR)
|
||||||
{
|
{
|
||||||
char *new_plugins = NULL;
|
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);
|
free (plugins);
|
||||||
plugins = new_plugins;
|
plugins = new_plugins;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ sleep_pid=$!
|
|||||||
rm merged/toremove
|
rm merged/toremove
|
||||||
grep 12345 /proc/$sleep_pid/fd/0
|
grep 12345 /proc/$sleep_pid/fd/0
|
||||||
|
|
||||||
RUN touch merged/a merged/b
|
touch merged/a merged/b
|
||||||
RUN chmod 6 merged/a
|
chmod 6 merged/a
|
||||||
RUN mv merged/a merged/x
|
mv merged/a merged/x
|
||||||
RUN mv merged/b merged/a
|
mv merged/b merged/a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user