Changeset 9e093855ceddcd07647592f55ed557655b1cc24d for src
- Timestamp:
- 07/28/11 18:59:49 (2 years ago)
- git-parent:
- Files:
-
- src/noit_check_log.c (modified) (1 diff)
- src/noit_check_tools_shared.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/noit_check_log.c
r076670c r9e09385 350 350 } 351 351 352 bundle.metrics = malloc(bundle.n_metrics * sizeof(Metric*)); 353 354 // Now convert 355 while(noit_hash_next(&c->metrics, &iter2, &key, &klen, &vm)) { 356 /* If we apply the filter set and it returns false, we don't log */ 357 metric_t *m = (metric_t *)vm; 358 bundle.metrics[i] = malloc(sizeof(Metric)); 359 metric__init(bundle.metrics[i]); 360 _noit_check_log_bundle_metric(ls, bundle.metrics[i], m); 361 i++; 352 if(bundle.n_metrics > 0) { 353 bundle.metrics = malloc(bundle.n_metrics * sizeof(Metric*)); 354 355 // Now convert 356 while(noit_hash_next(&c->metrics, &iter2, &key, &klen, &vm)) { 357 /* If we apply the filter set and it returns false, we don't log */ 358 metric_t *m = (metric_t *)vm; 359 bundle.metrics[i] = malloc(sizeof(Metric)); 360 metric__init(bundle.metrics[i]); 361 _noit_check_log_bundle_metric(ls, bundle.metrics[i], m); 362 i++; 363 } 362 364 } 363 365 src/noit_check_tools_shared.c
rb553f9a r9e09385 138 138 char *name, int name_len, 139 139 char *uuid, int uuid_len) { 140 if(!in || len == 0) return; 140 141 if(target) *target = '\0'; 141 142 if(module) *module = '\0'; 142 143 if(name) *name = '\0'; 143 144 if(uuid) *uuid = '\0'; 144 if( len >= UUID_STR_LEN) {145 if(uuid && len >= UUID_STR_LEN) { 145 146 memcpy(uuid, in + len - UUID_STR_LEN, UUID_STR_LEN); 146 147 uuid[UUID_STR_LEN] = '\0'; … … 153 154 if(!mcp) return; 154 155 /* copy in the target */ 155 if(target _len > mcp-tcp) {156 if(target && target_len > mcp-tcp) { 156 157 memcpy(target,tcp,mcp-tcp); 157 158 target[mcp-tcp] = '\0'; … … 161 162 if(!ncp) return; 162 163 /* copy in the module */ 163 if(module _len > ncp-mcp) {164 if(module && module_len > ncp-mcp) { 164 165 memcpy(module,mcp,ncp-mcp); 165 166 module[ncp-mcp] = '\0'; … … 169 170 ucp = in + len - UUID_STR_LEN - 1; 170 171 if(ncp < ucp) { 171 if(name _len > ucp-ncp) {172 if(name && name_len > ucp-ncp) { 172 173 memcpy(name, ncp, ucp-ncp); 173 174 name[ucp-ncp] = '\0';
