virtiofsd: Error on bad socket group name

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 <xiagao@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20211014122554.34599-1-dgilbert@redhat.com>
Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Dr. David Alan Gilbert 2021-10-14 13:25:54 +01:00
parent 50cf6d6cb7
commit 555a76e5e5
1 changed files with 7 additions and 0 deletions

View File

@ -988,6 +988,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);