All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtiofsd: Fix check of chown()'s return value
@ 2021-05-07 16:12 Greg Kurz
  2021-05-07 16:19 ` Eric Blake
  2021-05-10 14:16 ` Dr. David Alan Gilbert
  0 siblings, 2 replies; 6+ messages in thread
From: Greg Kurz @ 2021-05-07 16:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Dr. David Alan Gilbert

Otherwise you always get this warning when using --socket-group=users

 vhost socket failed to set group to users (100)

While here, print out the error if chown() fails.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 tools/virtiofsd/fuse_virtio.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
index 3e13997406bf..638d3ffe2f8a 100644
--- a/tools/virtiofsd/fuse_virtio.c
+++ b/tools/virtiofsd/fuse_virtio.c
@@ -978,9 +978,9 @@ static int fv_create_listen_socket(struct fuse_session *se)
     if (se->vu_socket_group) {
         struct group *g = getgrnam(se->vu_socket_group);
         if (g) {
-            if (!chown(se->vu_socket_path, -1, g->gr_gid)) {
+            if (chown(se->vu_socket_path, -1, g->gr_gid) == -1) {
                 fuse_log(FUSE_LOG_WARNING,
-                         "vhost socket failed to set group to %s (%d)\n",
+                         "vhost socket failed to set group to %s (%d): %m\n",
                          se->vu_socket_group, g->gr_gid);
             }
         }




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-13 15:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 16:12 [PATCH] virtiofsd: Fix check of chown()'s return value Greg Kurz
2021-05-07 16:19 ` Eric Blake
2021-05-07 16:34   ` Greg Kurz
2021-05-10 14:16 ` Dr. David Alan Gilbert
2021-05-10 14:23   ` Greg Kurz
2021-05-13 15:49     ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.