virtiofsd: Error on bad socket group name
PATCH 1/1 virtiofsd: Error on bad socket group name
From: "Dr. David Alan Gilbert" <[email protected]>
Make the '--socket-group=' option fail if the group name is unknown:
./tools/virtiofsd/virtiofsd .... --socket-group=zaphod vhost socket: unable to find group 'zaphod'
--- tools/virtiofsd/fuse_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/virtiofsd/fuse_virtio.c +7 -0
@@ -999,6 +999,13 @@ static int fv_create_listen_socket(struct fuse_session *se)"vhost socket failed to set group to %s (%d): %m\n" , se->vu_socket_group, g->gr_gid); } + }else { +fuse_log (FUSE_LOG_ERR , +"vhost socket: unable to find group '%s'\n" , + se->vu_socket_group); +close (listen_sock); +umask (old_umask); +return -1 ; } }umask (old_umask);
Signature · 1 line
2.31.1
Quoted 9 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Make the '--socket-group=' option fail if the group name is unknown:
./tools/virtiofsd/virtiofsd.... --socket-group=zaphod vhost socket: unable to find group 'zaphod'Reported-by Xiaoling Gao <[email protected]>Signed-off-by Dr. David Alan Gilbert <[email protected]>
Hi Dave,
This looks good to me. Just a minor nit for code cleanup. It could be done in a separate patch or sometime later as well.
Quoted 9 lines
--- tools/virtiofsd/fuse_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)tools/virtiofsd/fuse_virtio.c +0
-0
tools/virtiofsd/fuse_virtio.c static int fv_create_listen_socket(struct fuse_session *se) · line 1007
Quoted 9 lines
tools/virtiofsd/fuse_virtio.c +6
-0@@ -999,6 +999,13 @@ static int fv_create_listen_socket(struct fuse_session *se)"vhost socket failed to set group to %s (%d): %m\n" , se->vu_socket_group, g->gr_gid); } + }else { +fuse_log (FUSE_LOG_ERR , +"vhost socket: unable to find group '%s'\n" , + se->vu_socket_group); +close (listen_sock); +umask (old_umask);
^^^
tools/virtiofsd/fuse_virtio.c static int fv_create_listen_socket(struct fuse_session *se) · line 1011
Quoted 4 lines
tools/virtiofsd/fuse_virtio.c +1
-0+return -1 ; } }umask (old_umask);
This umask() call could be moved little early right after bind() call and that way we don't have to take care of calling umask(old_umask) in error path if group name could not be found.
Vivek
Quoted 8 lines
Signature · 6 lines
2.31.1 _______________________________________________ Virtio-fs mailing list [email protected] https://listman.redhat.com/mailman/listinfo/virtio-fs
Quoted 11 lines · * Vivek Goyal ([email protected]) wrote:
Quoted 9 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Make the '--socket-group=' option fail if the group name is unknown:
./tools/virtiofsd/virtiofsd.... --socket-group=zaphod vhost socket: unable to find group 'zaphod'Reported-by Xiaoling Gao <[email protected]>Signed-off-by Dr. David Alan Gilbert <[email protected]>
Quoted 6 lines
Hi Dave,
This looks good to me. Just a minor nit for code cleanup. It could be done in a separate patch or sometime later as well.
Reviewed-by Vivek Goyal <[email protected]>
Thanks
Quoted 19 lines
Quoted 9 lines
--- tools/virtiofsd/fuse_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)tools/virtiofsd/fuse_virtio.c +0
-0tools/virtiofsd/fuse_virtio.c static int fv_create_listen_socket(struct fuse_session *se) · line 1007
Quoted 9 lines
tools/virtiofsd/fuse_virtio.c +6
-0@@ -999,6 +999,13 @@ static int fv_create_listen_socket(struct fuse_session *se)"vhost socket failed to set group to %s (%d): %m\n" , se->vu_socket_group, g->gr_gid); } + }else { +fuse_log (FUSE_LOG_ERR , +"vhost socket: unable to find group '%s'\n" , + se->vu_socket_group); +close (listen_sock); +umask (old_umask);^^^
Quoted 8 lines
tools/virtiofsd/fuse_virtio.c static int fv_create_listen_socket(struct fuse_session *se) · line 1011
Quoted 4 lines
tools/virtiofsd/fuse_virtio.c +1
-0+return -1 ; } }umask (old_umask);This
umask()call could be moved little early right afterbind()call and that way we don't have to take care of callingumask(old_umask)in error path if group name could not be found.
One to fight another day.
Quoted 11 lines
Vivek
Quoted 8 lines
Signature · 6 lines
2.31.1 _______________________________________________ Virtio-fs mailing list [email protected] https://listman.redhat.com/mailman/listinfo/virtio-fs
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 9 lines · * Dr. David Alan Gilbert (git) ([email protected]) wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
Make the '--socket-group=' option fail if the group name is unknown:
./tools/virtiofsd/virtiofsd.... --socket-group=zaphod vhost socket: unable to find group 'zaphod'Reported-by Xiaoling Gao <[email protected]>Signed-off-by Dr. David Alan Gilbert <[email protected]>
Queued
Quoted 26 lines
--- tools/virtiofsd/fuse_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)tools/virtiofsd/fuse_virtio.c +7
-0@@ -999,6 +999,13 @@ static int fv_create_listen_socket(struct fuse_session *se)"vhost socket failed to set group to %s (%d): %m\n" , se->vu_socket_group, g->gr_gid); } + }else { +fuse_log (FUSE_LOG_ERR , +"vhost socket: unable to find group '%s'\n" , + se->vu_socket_group); +close (listen_sock); +umask (old_umask); +return -1 ; } }umask (old_umask);Signature · 1 line
2.31.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK