From 392e1bc2e86b7830ad0c825f67e08b98175a0111 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 16 Jan 2007 21:13:07 +0000 Subject: [PATCH] more little fixes --- daemons/dmeventd/dmeventd.c | 2 +- daemons/dmeventd/libdevmapper-event.c | 7 +++++-- libdm/libdm-report.c | 6 +++--- tools/dmsetup.c | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c index 37b90689f..13e6c5914 100644 --- a/daemons/dmeventd/dmeventd.c +++ b/daemons/dmeventd/dmeventd.c @@ -246,7 +246,7 @@ static void _free_dso_data(struct dso_data *data) */ /* FIXME? move to libdevmapper to share with the client lib (need to make delimiter a parameter then) */ -static int _fetch_string(char **ptr, char **src, const char delimiter) +static int _fetch_string(char **ptr, char **src, const int delimiter) { int ret = 0; char *p; diff --git a/daemons/dmeventd/libdevmapper-event.c b/daemons/dmeventd/libdevmapper-event.c index 338bf97da..f792219fe 100644 --- a/daemons/dmeventd/libdevmapper-event.c +++ b/daemons/dmeventd/libdevmapper-event.c @@ -262,6 +262,7 @@ static int _daemon_talk(struct dm_event_fifos *fifos, const char *dso = dso_name ? dso_name : ""; const char *dev = dev_name ? dev_name : ""; const char *fmt = "%s %s %u %" PRIu32; + int msg_size; memset(msg, 0, sizeof(*msg)); /* @@ -269,10 +270,12 @@ static int _daemon_talk(struct dm_event_fifos *fifos, * into ASCII message string. */ msg->cmd = cmd; - if ((msg->size = dm_asprintf(&(msg->data), fmt, dso, dev, evmask, + if ((msg_size = dm_asprintf(&(msg->data), fmt, dso, dev, evmask, timeout)) < 0) { log_error("_daemon_talk: message allocation failed"); + return -ENOMEM; } + msg->size = msg_size; /* * Write command and message to and @@ -535,7 +538,7 @@ int dm_event_unregister_handler(const struct dm_event_handler *dmevh) /* Fetch a string off src and duplicate it into *dest. */ /* FIXME: move to separate module to share with the daemon. */ -static char *_fetch_string(char **src, const char delimiter) +static char *_fetch_string(char **src, const int delimiter) { char *p, *ret; diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index de93dc255..bd9f76482 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -60,7 +60,7 @@ struct field_properties { struct list list; uint32_t field_num; uint32_t sort_posn; - int width; + unsigned width; const struct dm_report_object_type *type; uint32_t flags; }; @@ -667,7 +667,7 @@ static int _row_compare(const void *a, const void *b) const struct row *rowa = *(const struct row **) a; const struct row *rowb = *(const struct row **) b; const struct dm_report_field *sfa, *sfb; - int32_t cnt = -1; + uint32_t cnt; for (cnt = 0; cnt < rowa->rh->keys_count; cnt++) { sfa = (*rowa->sort_fields)[cnt]; @@ -739,7 +739,7 @@ int dm_report_output(struct dm_report *rh) struct dm_report_field *field; const char *repstr; char buf[4096]; - int width; + unsigned width; if (list_empty(&rh->rows)) return 1; diff --git a/tools/dmsetup.c b/tools/dmsetup.c index d7711b307..91a3fde6c 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -1673,7 +1673,7 @@ static char *parse_loop_device_name(char *dev) char *buf; char *device; - if (!(buf = dm_malloc(PATH_MAX))); + if (!(buf = dm_malloc(PATH_MAX))) return NULL; if (dev[0] == '/') {