master - libdaemon: fix passing 32bit values for %d
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=32762e2a9c897723fa1c124f5ba723d430448902 Commit: 32762e2a9c897723fa1c124f5ba723d430448902 Parent: e207ededd607fe30cf1f10d5c4415ed30b2d030c Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Nov 9 15:15:37 2015 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Nov 9 17:04:10 2015 +0100
libdaemon: fix passing 32bit values for %d
Since %d is now prohibited for its great confusion, replace it with FMTd64 and correctly converted int64_t parameter.
--- WHATS_NEW | 1 + daemons/lvmetad/lvmetactl.c | 20 +++++++++--------- daemons/lvmlockd/lvmlockctl.c | 8 +++--- daemons/lvmlockd/lvmlockd-core.c | 24 ++++++++++---------- daemons/lvmpolld/lvmpolld-core.c | 2 +- lib/cache/lvmetad.c | 2 +- lib/locking/lvmlockd.c | 42 +++++++++++++++++++------------------- lib/lvmpolld/lvmpolld-client.c | 8 +++--- 8 files changed, 54 insertions(+), 53 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.135 - ==================================== + Fix passing of 32bit values through daemons (mostly lvmlockd). Use local memory pool for whole alloc_handle manipulation. Add missing pointer validation after dm_get_next_target(). Do not deref NULL pointer in debug message for _match_pv_tags().
daemons/lvmetad/lvmetactl.c +10 -10
@@ -77,7 +77,7 @@ int main(int argc, char **argv) val =atoi (argv[2 ]); reply =daemon_send_simple (h,"set_global_info" , -"global_invalid = %d" , val, +"global_invalid = " FMTd64, (int64_t ) val,"token = %s" ,"skip" ,NULL );print_reply (reply);
@@ -106,21 +106,21 @@ int main(int argc, char **argv) reply =daemon_send_simple (h,"set_vg_info" ,"uuid = %s" , uuid,"name = %s" , name, -"version = %d" , ver, -"token = %s" ,"skip" , -NULL ); +"version = " FMTd64, (int64_t ) ver, +"token = %s" ,"skip" , +NULL ); }else if (uuid) { reply =daemon_send_simple (h,"set_vg_info" ,"uuid = %s" , uuid, -"version = %d" , ver, -"token = %s" ,"skip" , -NULL ); +"version = " FMTd64, (int64_t ) ver, +"token = %s" ,"skip" , +NULL ); }else if (name) { reply =daemon_send_simple (h,"set_vg_info" ,"name = %s" , name, -"version = %d" , ver, -"token = %s" ,"skip" , -NULL ); +"version = " FMTd64, (int64_t ) ver, +"token = %s" ,"skip" , +NULL ); }else {printf ("name or uuid required\n" );return -1 ;
daemons/lvmlockd/lvmlockctl.c +4 -4
@@ -456,7 +456,7 @@ static int do_able(const char *req_name) reply =_lvmlockd_send (req_name,"cmd = %s" ,"lvmlockctl" , -"pid = %d" ,getpid (), +"pid = " FMTd64, (int64_t )getpid (),"vg_name = %s" , arg_vg_name,NULL );
@@ -487,7 +487,7 @@ static int do_stop_lockspaces(void) reply =_lvmlockd_send ("stop_all" ,"cmd = %s" ,"lvmlockctl" , -"pid = %d" ,getpid (), +"pid = " FMTd64, (int64_t )getpid (),"opts = %s" , opts[0 ] ? opts :"none" ,NULL );
@@ -522,7 +522,7 @@ static int do_kill(void) reply =_lvmlockd_send ("kill_vg" ,"cmd = %s" ,"lvmlockctl" , -"pid = %d" ,getpid (), +"pid = " FMTd64, (int64_t )getpid (),"vg_name = %s" , arg_vg_name,NULL );
@@ -568,7 +568,7 @@ static int do_drop(void) reply =_lvmlockd_send ("drop_vg" ,"cmd = %s" ,"lvmlockctl" , -"pid = %d" ,getpid (), +"pid = " FMTd64, (int64_t )getpid (),"vg_name = %s" , arg_vg_name,NULL );
daemons/lvmlockd/lvmlockd-core.c +12 -12
@@ -1252,7 +1252,7 @@ static int res_lock(struct lockspace *ls, struct resource *r, struct action *act"token = %s" ,"skip" ,"uuid = %s" , uuid,"name = %s" , ls->vg_name, -"version = %d" , (int )new_version, +"version = " FMTd64, (int64_t )new_version, NULL);pthread_mutex_unlock (&lvmetad_mutex);
@@ -1270,7 +1270,7 @@ static int res_lock(struct lockspace *ls, struct resource *r, struct action *actpthread_mutex_lock (&lvmetad_mutex); reply =daemon_send_simple (lvmetad_handle,"set_global_info" ,"token = %s" ,"skip" , -"global_invalid = %d" ,1 , +"global_invalid = " FMTd64,INT64_C (1 ),NULL );pthread_mutex_unlock (&lvmetad_mutex);
@@ -3624,9 +3624,9 @@ static int client_send_result(struct client *cl, struct action *act) act->result, vg_args ? vg_args : "", lv_args ? lv_args : ""); res = daemon_reply_simple("OK", - "op = %d", act->op, - "op_result = %d", act->result, - "lm_result = %d", act->lm_rv, + "op = " FMTd64, (int64_t)act->op, + "op_result = " FMTd64, (int64_t) act->result, + "lm_result = " FMTd64, (int64_t) act->lm_rv, "vg_lock_args = %s", vg_args, "lv_lock_args = %s", lv_args, "result_flags = %s", result_flags[0] ? result_flags : "none",
@@ -3655,8 +3655,8 @@ static int client_send_result(struct client *cl, struct action *act) act->result, dump_len); res =daemon_reply_simple ("OK" , -"result = %d" , act->result, -"dump_len = %d" , dump_len, +"result = " FMTd64, (int64_t ) act->result, +"dump_len = " FMTd64, (int64_t ) dump_len,NULL ); }else {/*
@@ -3669,10 +3669,10 @@ static int client_send_result(struct client *cl, struct action *act) act->result, (act->result == -ENOLS) ? "ENOLS" : "", result_flags); res =daemon_reply_simple ("OK" , -"op = %d" , act->op, +"op = " FMTd64, (int64_t ) act->op,"lock_type = %s" ,lm_str (act->lm_type), -"op_result = %d" , act->result, -"lm_result = %d" , act->lm_rv, +"op_result = " FMTd64, (int64_t ) act->result, +"lm_result = " FMTd64, (int64_t ) act->lm_rv,"result_flags = %s" , result_flags[0 ] ? result_flags :"none" ,NULL ); }
@@ -4399,9 +4399,9 @@ static void client_recv_action(struct client *cl)buffer_init (&res.buffer); res =daemon_reply_simple ("OK" , -"result = %d" , result, +"result = " FMTd64, (int64_t ) result,"protocol = %s" , lvmlockd_protocol, -"version = %d" , lvmlockd_protocol_version, +"version = " FMTd64, (int64_t ) lvmlockd_protocol_version,NULL );buffer_write (cl->fd, &res.buffer);buffer_destroy (&res.buffer);
daemons/lvmpolld/lvmpolld-core.c +1 -1
@@ -539,7 +539,7 @@ static response progress_info(client_handle h, struct lvmpolld_state *ls, requesif (st.polling_finished) r =daemon_reply_simple (LVMPD_RESP_FINISHED ,"reason = %s" , st.cmd_state.signal ?LVMPD_REAS_SIGNAL :LVMPD_REAS_RETCODE , -LVMPD_PARM_VALUE " = %d" , (int64_t )(st.cmd_state.signal ?: st.cmd_state.retcode), +LVMPD_PARM_VALUE " = " FMTd64, (int64_t )(st.cmd_state.signal ?: st.cmd_state.retcode),NULL );else r =daemon_reply_simple (LVMPD_RESP_IN_PROGRESS ,NULL );
lib/cache/lvmetad.c +1 -1
@@ -1744,7 +1744,7 @@ void lvmetad_validate_global_cache(struct cmd_context *cmd, int force)*/ reply =daemon_send_simple (_lvmetad,"set_global_info" ,"token = %s" ,"skip" , -"global_invalid = %d" ,0 , +"global_invalid = " FMTd64,INT64_C (0 ),NULL );if (reply.error)log_error ("lvmetad_validate_global_cache set_global_info error %d" , reply.error);
lib/locking/lvmlockd.c +21 -21
155 lines not on this page · raw message
lib/lvmpolld/lvmpolld-client.c +4 -4
@@ -147,7 +147,7 @@ static struct progress_info _request_progress_info(const char *uuid, unsigned ab }if (abort_polling && - !daemon_request_extend (req,LVMPD_PARM_ABORT " = %d" , (int64_t )abort_polling,NULL )) { + !daemon_request_extend (req,LVMPD_PARM_ABORT " = " FMTd64, (int64_t ) abort_polling,NULL )) {log_error ("Failed to create " LVMPD_REQ_PROGRESS " request." ); goto out_req; }
@@ -228,14 +228,14 @@ static int _process_poll_init(const struct cmd_context *cmd, const char *poll_ty }if (parms->aborting && - !(daemon_request_extend (req,LVMPD_PARM_ABORT " = %d" , (int64_t )(parms->aborting),NULL ))) { + !(daemon_request_extend (req,LVMPD_PARM_ABORT " = " FMTd64, (int64_t ) (parms->aborting),NULL ))) {log_error ("Failed to create %s request." , poll_type); goto out_req; }if (cmd->handles_missing_pvs && - !(daemon_request_extend (req,LVMPD_PARM_HANDLE_MISSING_PVS " = %d" , - (int64_t )(cmd->handles_missing_pvs),NULL ))) { + !(daemon_request_extend (req,LVMPD_PARM_HANDLE_MISSING_PVS " = " FMTd64, + (int64_t ) (cmd->handles_missing_pvs),NULL ))) {log_error ("Failed to create %s request." , poll_type); goto out_req; }