|
|
7100e8 |
commit 0c88fc0aa260dcd50e654275cc9fdd68e27a2617
|
|
|
7100e8 |
Author: David Vossel <dvossel@redhat.com>
|
|
|
7100e8 |
Date: Wed Dec 4 17:04:52 2013 -0600
|
|
|
7100e8 |
|
|
|
7100e8 |
Fix: Removes unnecessary newlines in crm_resource -O output
|
|
|
7100e8 |
|
|
|
7100e8 |
Resolves: rhbz#1038155
|
|
|
7100e8 |
(cherry picked from commit cd56faa1c9168811b64be9f7eea73ad600261844)
|
|
|
7100e8 |
|
|
|
7100e8 |
diff --git a/include/crm/common/util.h b/include/crm/common/util.h
|
|
|
7100e8 |
index f0dca36..9092708 100644
|
|
|
7100e8 |
--- a/include/crm/common/util.h
|
|
|
7100e8 |
+++ b/include/crm/common/util.h
|
|
|
7100e8 |
@@ -67,6 +67,8 @@ gboolean decode_transition_key(const char *key, char **uuid, int *action, int *t
|
|
|
7100e8 |
gboolean decode_transition_magic(const char *magic, char **uuid, int *transition_id, int *action_id,
|
|
|
7100e8 |
int *op_status, int *op_rc, int *target_rc);
|
|
|
7100e8 |
|
|
|
7100e8 |
+char * crm_strip_trailing_newline(char *str);
|
|
|
7100e8 |
+
|
|
|
7100e8 |
# define safe_str_eq(a, b) crm_str_eq(a, b, FALSE)
|
|
|
7100e8 |
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case);
|
|
|
7100e8 |
gboolean safe_str_neq(const char *a, const char *b);
|
|
|
7100e8 |
diff --git a/lib/common/utils.c b/lib/common/utils.c
|
|
|
7100e8 |
index 527c9e0..4e18039 100644
|
|
|
7100e8 |
--- a/lib/common/utils.c
|
|
|
7100e8 |
+++ b/lib/common/utils.c
|
|
|
7100e8 |
@@ -1550,6 +1550,22 @@ crm_is_writable(const char *dir, const char *file,
|
|
|
7100e8 |
return pass;
|
|
|
7100e8 |
}
|
|
|
7100e8 |
|
|
|
7100e8 |
+char *
|
|
|
7100e8 |
+crm_strip_trailing_newline(char *str)
|
|
|
7100e8 |
+{
|
|
|
7100e8 |
+ int len;
|
|
|
7100e8 |
+
|
|
|
7100e8 |
+ if (str == NULL) {
|
|
|
7100e8 |
+ return str;
|
|
|
7100e8 |
+ }
|
|
|
7100e8 |
+
|
|
|
7100e8 |
+ for (len = strlen(str) - 1; len >= 0 && str[len] == '\n'; len--) {
|
|
|
7100e8 |
+ str[len] = '\0';
|
|
|
7100e8 |
+ }
|
|
|
7100e8 |
+
|
|
|
7100e8 |
+ return str;
|
|
|
7100e8 |
+}
|
|
|
7100e8 |
+
|
|
|
7100e8 |
gboolean
|
|
|
7100e8 |
crm_str_eq(const char *a, const char *b, gboolean use_case)
|
|
|
7100e8 |
{
|
|
|
7100e8 |
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
|
|
|
7100e8 |
index c03501d..2f0e282 100644
|
|
|
7100e8 |
--- a/tools/crm_resource.c
|
|
|
7100e8 |
+++ b/tools/crm_resource.c
|
|
|
7100e8 |
@@ -1119,8 +1119,8 @@ list_resource_operations(const char *rsc_id, const char *host_uname, gboolean ac
|
|
|
7100e8 |
if (last) {
|
|
|
7100e8 |
time_t run_at = crm_parse_int(last, "0");
|
|
|
7100e8 |
|
|
|
7100e8 |
- fprintf(stdout, ", last-rc-change=%s, exec=%sms\n",
|
|
|
7100e8 |
- ctime(&run_at), crm_element_value(xml_op, XML_RSC_OP_T_EXEC));
|
|
|
7100e8 |
+ fprintf(stdout, ", last-rc-change=%s, exec=%sms",
|
|
|
7100e8 |
+ crm_strip_trailing_newline(ctime(&run_at)), crm_element_value(xml_op, XML_RSC_OP_T_EXEC));
|
|
|
7100e8 |
}
|
|
|
7100e8 |
fprintf(stdout, "): %s\n", services_lrm_status_str(status));
|
|
|
7100e8 |
}
|