main: avoid temporary copy

use directly node->path instead of copying it to a temporary buffer.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2021-04-19 09:32:12 +02:00
parent 8241648406
commit a8d7c0b0f4
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

6
main.c
View File

@ -5033,7 +5033,6 @@ do_fsync (fuse_req_t req, fuse_ino_t ino, int datasync, int fd)
struct ovl_node *node; struct ovl_node *node;
struct ovl_data *lo = ovl_data (req); struct ovl_data *lo = ovl_data (req);
cleanup_lock int l = 0; cleanup_lock int l = 0;
char path[PATH_MAX];
if (!lo->fsync) if (!lo->fsync)
{ {
@ -5059,9 +5058,6 @@ do_fsync (fuse_req_t req, fuse_ino_t ino, int datasync, int fd)
return; return;
} }
if (fd < 0)
strncpy (path, node->path, PATH_MAX);
if (! do_fsync) if (! do_fsync)
{ {
fuse_reply_err (req, 0); fuse_reply_err (req, 0);
@ -5069,7 +5065,7 @@ do_fsync (fuse_req_t req, fuse_ino_t ino, int datasync, int fd)
} }
if (do_fsync) if (do_fsync)
ret = direct_fsync (node->layer, fd, path, datasync); ret = direct_fsync (node->layer, fd, node->path, datasync);
fuse_reply_err (req, ret == 0 ? 0 : errno); fuse_reply_err (req, ret == 0 ? 0 : errno);
} }