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

lvmlockd-dlm: log_error message with literal

Use literals for printf() message construction.
This commit is contained in:
Zdenek Kabelac 2024-05-04 12:25:36 +02:00
parent e56e7ed533
commit 91991e3cc1

View File

@ -96,7 +96,6 @@ static int check_args_version(char *vg_args)
static int read_cluster_name(char *clustername) static int read_cluster_name(char *clustername)
{ {
static const char close_error_msg[] = "read_cluster_name: close_error %d";
char *n; char *n;
int fd; int fd;
int rv; int rv;
@ -115,18 +114,19 @@ static int read_cluster_name(char *clustername)
rv = read(fd, clustername, MAX_ARGS); rv = read(fd, clustername, MAX_ARGS);
if (rv < 0) { if (rv < 0) {
log_error("read_cluster_name: cluster name read error %d, check dlm_controld", fd); log_error("read_cluster_name: cluster name read error %d, check dlm_controld", fd);
if (close(fd)) goto out;
log_error(close_error_msg, fd);
return rv;
} }
clustername[rv] = 0; clustername[rv] = 0;
n = strstr(clustername, "\n"); n = strstr(clustername, "\n");
if (n) if (n)
*n = '\0'; *n = '\0';
rv = 0;
out:
if (close(fd)) if (close(fd))
log_error(close_error_msg, fd); log_error("read_cluster_name: close_error %d", fd);
return 0;
return rv;
} }
#define MAX_VERSION 16 #define MAX_VERSION 16
@ -786,7 +786,6 @@ int lm_unlock_dlm(struct lockspace *ls, struct resource *r,
int lm_hosts_dlm(struct lockspace *ls, int notify) int lm_hosts_dlm(struct lockspace *ls, int notify)
{ {
static const char closedir_err_msg[] = "lm_hosts_dlm: closedir failed";
char ls_nodes_path[PATH_MAX]; char ls_nodes_path[PATH_MAX];
struct dirent *de; struct dirent *de;
DIR *ls_dir; DIR *ls_dir;
@ -809,7 +808,7 @@ int lm_hosts_dlm(struct lockspace *ls, int notify)
} }
if (closedir(ls_dir)) if (closedir(ls_dir))
log_error(closedir_err_msg); log_error("lm_hosts_dlm: closedir failed");
if (!count) { if (!count) {
log_error("lm_hosts_dlm found no nodes in %s", ls_nodes_path); log_error("lm_hosts_dlm found no nodes in %s", ls_nodes_path);
@ -826,10 +825,10 @@ int lm_hosts_dlm(struct lockspace *ls, int notify)
int lm_get_lockspaces_dlm(struct list_head *ls_rejoin) int lm_get_lockspaces_dlm(struct list_head *ls_rejoin)
{ {
static const char closedir_err_msg[] = "lm_get_lockspace_dlm: closedir failed";
struct lockspace *ls; struct lockspace *ls;
struct dirent *de; struct dirent *de;
DIR *ls_dir; DIR *ls_dir;
int ret = 0;
if (!(ls_dir = opendir(DLM_LOCKSPACES_PATH))) if (!(ls_dir = opendir(DLM_LOCKSPACES_PATH)))
return -ECONNREFUSED; return -ECONNREFUSED;
@ -842,9 +841,8 @@ int lm_get_lockspaces_dlm(struct list_head *ls_rejoin)
continue; continue;
if (!(ls = alloc_lockspace())) { if (!(ls = alloc_lockspace())) {
if (closedir(ls_dir)) ret = -ENOMEM;
log_error(closedir_err_msg); goto out;
return -ENOMEM;
} }
ls->lm_type = LD_LM_DLM; ls->lm_type = LD_LM_DLM;
@ -852,10 +850,11 @@ int lm_get_lockspaces_dlm(struct list_head *ls_rejoin)
dm_strncpy(ls->vg_name, ls->name + strlen(LVM_LS_PREFIX), sizeof(ls->vg_name)); dm_strncpy(ls->vg_name, ls->name + strlen(LVM_LS_PREFIX), sizeof(ls->vg_name));
list_add_tail(&ls->list, ls_rejoin); list_add_tail(&ls->list, ls_rejoin);
} }
out:
if (closedir(ls_dir)) if (closedir(ls_dir))
log_error(closedir_err_msg); log_error("lm_get_lockspace_dlm: closedir failed");
return 0;
return ret;
} }
int lm_is_running_dlm(void) int lm_is_running_dlm(void)