mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-17 06:04:23 +03:00
lvmetad: keep returned struct fully initialized
Always clear the response structure. Simplify daemon_reply initialization.
This commit is contained in:
parent
a4269aadf3
commit
399fc1bb33
@ -292,7 +292,7 @@ static response pv_list(lvmetad_state *s, request r)
|
||||
struct dm_config_node *cn = NULL, *cn_pvs;
|
||||
struct dm_hash_node *n;
|
||||
const char *id;
|
||||
response res;
|
||||
response res = { 0 };
|
||||
|
||||
buffer_init( &res.buffer );
|
||||
|
||||
@ -320,7 +320,7 @@ static response pv_lookup(lvmetad_state *s, request r)
|
||||
{
|
||||
const char *pvid = daemon_request_str(r, "uuid", NULL);
|
||||
int64_t devt = daemon_request_int(r, "device", 0);
|
||||
response res;
|
||||
response res = { 0 };
|
||||
struct dm_config_node *pv;
|
||||
|
||||
buffer_init( &res.buffer );
|
||||
@ -364,7 +364,7 @@ static response vg_list(lvmetad_state *s, request r)
|
||||
struct dm_hash_node *n;
|
||||
const char *id;
|
||||
const char *name;
|
||||
response res;
|
||||
response res = { 0 };
|
||||
|
||||
buffer_init( &res.buffer );
|
||||
|
||||
@ -434,7 +434,7 @@ static response vg_lookup(lvmetad_state *s, request r)
|
||||
{
|
||||
struct dm_config_tree *cft;
|
||||
struct dm_config_node *metadata, *n;
|
||||
response res;
|
||||
response res = { 0 };
|
||||
|
||||
const char *uuid = daemon_request_str(r, "uuid", NULL);
|
||||
const char *name = daemon_request_str(r, "name", NULL);
|
||||
@ -492,7 +492,6 @@ static response vg_lookup(lvmetad_state *s, request r)
|
||||
if (!(n = n->sib = dm_config_clone_node(res.cft, metadata, 1)))
|
||||
goto bad;
|
||||
n->parent = res.cft->root;
|
||||
res.error = 0;
|
||||
unlock_vg(s, uuid);
|
||||
|
||||
update_pv_status(s, res.cft, n, 1); /* FIXME report errors */
|
||||
@ -987,7 +986,7 @@ static void _dump_pairs(struct buffer *buf, struct dm_hash_table *ht, const char
|
||||
|
||||
static response dump(lvmetad_state *s)
|
||||
{
|
||||
response res;
|
||||
response res = { 0 };
|
||||
struct buffer *b = &res.buffer;
|
||||
|
||||
buffer_init(b);
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
daemon_handle daemon_open(daemon_info i) {
|
||||
daemon_handle h = { .protocol_version = 0, .error = 0 };
|
||||
daemon_reply r = { .cft = NULL };
|
||||
daemon_reply r = { 0 };
|
||||
struct sockaddr_un sockaddr = { .sun_family = AF_UNIX };
|
||||
|
||||
if ((h.socket_fd = socket(PF_UNIX, SOCK_STREAM /* | SOCK_NONBLOCK */, 0)) < 0)
|
||||
@ -72,7 +72,7 @@ error:
|
||||
daemon_reply daemon_send(daemon_handle h, daemon_request rq)
|
||||
{
|
||||
struct buffer buffer;
|
||||
daemon_reply reply = { .cft = NULL, .error = 0 };
|
||||
daemon_reply reply = { 0 };
|
||||
assert(h.socket_fd >= 0);
|
||||
buffer = rq.buffer;
|
||||
|
||||
@ -104,7 +104,7 @@ void daemon_reply_destroy(daemon_reply r) {
|
||||
|
||||
daemon_reply daemon_send_simple_v(daemon_handle h, const char *id, va_list ap)
|
||||
{
|
||||
static const daemon_reply err = { .error = ENOMEM, .buffer = { 0, 0, NULL }, .cft = NULL };
|
||||
static const daemon_reply err = { .error = ENOMEM };
|
||||
daemon_request rq = { .cft = NULL };
|
||||
daemon_reply repl;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user