Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
libdlm.1092
bnc#875122dlm_controld-fix-long-name-in-log-ent...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bnc#875122dlm_controld-fix-long-name-in-log-entry.patch of Package libdlm.1092
From 4283123f0b13eafc46d825050c5142cf44be79c3 Mon Sep 17 00:00:00 2001 From: Lidong Zhong <lzhong@suse.com> Date: Fri, 25 Apr 2014 10:52:52 -0500 Subject: [PATCH 1/1] dlm_controld: fix long name in log entry When the length of name_in is NAME_ID_SIZE, the last byte of the name and a whitespace will get lost. (Modified by teigland@redhat.com to also handle names longer than NAME_ID_SIZE.) Signed-off-by: Lidong Zhong <lzhong@suse.com> --- dlm_controld/logging.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dlm_controld/logging.c b/dlm_controld/logging.c index 9347e43..4aa3406 100644 --- a/dlm_controld/logging.c +++ b/dlm_controld/logging.c @@ -122,17 +122,23 @@ static void log_save_str(int len, char *log_buf, unsigned int *point, void log_level(char *name_in, uint32_t level_in, const char *fmt, ...) { va_list ap; - char name[NAME_ID_SIZE + 1]; + char name[NAME_ID_SIZE + 2]; uint32_t level = level_in & 0x0000FFFF; uint32_t extra = level_in & 0xFFFF0000; int ret, pos = 0; int len = LOG_STR_LEN - 2; + int namelen = 0; int plock = extra & LOG_PLOCK; memset(name, 0, sizeof(name)); - if (name_in) - snprintf(name, NAME_ID_SIZE, "%s ", name_in); + if (name_in) { + namelen = snprintf(name, NAME_ID_SIZE + 1, "%s", name_in); + if (namelen > NAME_ID_SIZE) + namelen = NAME_ID_SIZE; + name[namelen] = ' '; + name[namelen+1] = '\0'; + } ret = snprintf(log_str + pos, len - pos, "%llu %s", (unsigned long long)monotime(), name); -- 1.8.1.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor