1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: add error path for daemon_request_extend

Check for errors in daemon_request_extend().
This commit is contained in:
Zdenek Kabelac 2021-09-20 01:48:30 +02:00
parent 6427803252
commit e1840dd9e0

View File

@ -186,7 +186,7 @@ static int _lockd_result(daemon_reply reply, int *result, uint32_t *lockd_flags)
static daemon_reply _lockd_send_with_pvs(const char *req_name,
const struct lvmlockd_pvs *lock_pvs, ...)
{
daemon_reply repl;
daemon_reply repl = { .error = -1 };
daemon_request req;
int i;
char key[32];
@ -201,18 +201,23 @@ static daemon_reply _lockd_send_with_pvs(const char *req_name,
/* Pass PV list */
if (lock_pvs && lock_pvs->num) {
daemon_request_extend(req, "path_num = " FMTd64,
(int64_t)(lock_pvs)->num, NULL);
if (!daemon_request_extend(req, "path_num = " FMTd64,
(int64_t)(lock_pvs)->num, NULL)) {
log_error("Failed to create pvs request.");
goto bad;
}
for (i = 0; i < lock_pvs->num; i++) {
snprintf(key, sizeof(key), "path[%d] = %%s", i);
val = lock_pvs->path[i] ? lock_pvs->path[i] : "none";
daemon_request_extend(req, key, val, NULL);
if (!daemon_request_extend(req, key, val, NULL)) {
log_error("Failed to create pvs request.");
goto bad;
}
}
}
repl = daemon_send(_lvmlockd, req);
bad:
daemon_request_destroy(req);
return repl;