mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-16 02:39:29 -04:00
fuse-overlayfs: remove duplicate variable in ovl_rename_direct
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
b3f454183f
commit
e908a68156
44
main.c
44
main.c
@ -2702,7 +2702,7 @@ ovl_rename_direct (fuse_req_t req, fuse_ino_t parent, const char *name,
|
|||||||
int saved_errno;
|
int saved_errno;
|
||||||
int srcfd = -1;
|
int srcfd = -1;
|
||||||
int destfd = -1;
|
int destfd = -1;
|
||||||
struct ovl_node key, *rm = NULL;
|
struct ovl_node key;
|
||||||
|
|
||||||
node = do_lookup_file (lo, parent, name);
|
node = do_lookup_file (lo, parent, name);
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
@ -2749,22 +2749,17 @@ ovl_rename_direct (fuse_req_t req, fuse_ino_t parent, const char *name,
|
|||||||
goto error;
|
goto error;
|
||||||
destfd = ret;
|
destfd = ret;
|
||||||
|
|
||||||
destnode = do_lookup_file (lo, newparent, newname);
|
key.name = (char *) newname;
|
||||||
|
destnode = hash_lookup (destpnode->children, &key);
|
||||||
|
|
||||||
node = get_node_up (lo, node);
|
node = get_node_up (lo, node);
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
key.name = (char *) newname;
|
if (flags & RENAME_NOREPLACE && destnode && !destnode->whiteout)
|
||||||
if (flags & RENAME_NOREPLACE)
|
|
||||||
{
|
{
|
||||||
rm = hash_lookup (destpnode->children, &key);
|
errno = EEXIST;
|
||||||
if (rm && !rm->whiteout)
|
goto error;
|
||||||
{
|
|
||||||
errno = EEXIST;
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destnode != NULL && !destnode->whiteout && node_dirp (destnode))
|
if (destnode != NULL && !destnode->whiteout && node_dirp (destnode))
|
||||||
@ -2791,39 +2786,38 @@ ovl_rename_direct (fuse_req_t req, fuse_ino_t parent, const char *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rm = hash_lookup (destpnode->children, &key);
|
if (destnode)
|
||||||
if (rm)
|
|
||||||
{
|
{
|
||||||
if (!rm->whiteout && rm->ino == node->ino)
|
if (!destnode->whiteout && destnode->ino == node->ino)
|
||||||
goto error;
|
goto error;
|
||||||
if (node_dirp (node) && rm->present_lowerdir)
|
|
||||||
|
if (node_dirp (node) && destnode->present_lowerdir)
|
||||||
{
|
{
|
||||||
if (create_missing_whiteouts (lo, node, rm->path) < 0)
|
if (create_missing_whiteouts (lo, node, destnode->path) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash_delete (destpnode->children, rm);
|
if (destnode->lookups > 0)
|
||||||
if (rm->lookups > 0)
|
node_free (destnode);
|
||||||
node_free (rm);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
node_free (rm);
|
node_free (destnode);
|
||||||
rm = NULL;
|
destnode = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rm)
|
if (destnode)
|
||||||
{
|
{
|
||||||
/* If the node is still accessible then be sure we
|
/* If the node is still accessible then be sure we
|
||||||
can write to it. Fix it to be done when a write is
|
can write to it. Fix it to be done when a write is
|
||||||
really done, not now. */
|
really done, not now. */
|
||||||
rm = get_node_up (lo, rm);
|
destnode = get_node_up (lo, destnode);
|
||||||
if (rm == NULL)
|
if (destnode == NULL)
|
||||||
{
|
{
|
||||||
fuse_reply_err (req, errno);
|
fuse_reply_err (req, errno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hide_node (lo, rm, false) < 0)
|
if (hide_node (lo, destnode, false) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user