X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=blobdiff_plain;f=util.c;h=8c23485c059581cbb2aef2c1d8c40628dbaeecaa;hp=cfaefd227148c5f908f707b6f0b31ba48f21037c;hb=53dea2fbb44f128eb4f6c2259adcd9fbefe1527e;hpb=1ce2f8bc69bc1bef98b48f450081d96e2c29cc00 diff --git a/util.c b/util.c index cfaefd2..8c23485 100644 --- a/util.c +++ b/util.c @@ -61,7 +61,7 @@ char *safe_strdup(const char *s, const char *message) char *d; d=strdup(s); if (!d) { - fatal_perror(message); + fatal_perror("%s",message); } return d; } @@ -71,7 +71,7 @@ void *safe_malloc(size_t size, const char *message) void *r; r=malloc(size); if (!r) { - fatal_perror(message); + fatal_perror("%s",message); } return r; } @@ -208,7 +208,7 @@ bool_t remove_hook(uint32_t phase, hook_fn *fn, void *state) void vslilog(struct log_if *lf, int priority, const char *message, va_list ap) { - lf->vlog(lf->st,priority,message,ap); + lf->vlogfn(lf->st,priority,message,ap); } void slilog(struct log_if *lf, int priority, const char *message, ...) @@ -387,7 +387,7 @@ void send_nak(const struct comm_addr *dest, uint32_t our_index, uint32_t their_index, uint32_t msgtype, struct buffer_if *buf, const char *logwhy) { - buffer_init(buf,dest->comm->min_start_pad); + buffer_init(buf,calculate_max_start_pad()); buf_append_uint32(buf,their_index); buf_append_uint32(buf,our_index); buf_append_uint32(buf,LABEL_NAK); @@ -419,3 +419,19 @@ void util_module(dict_t *dict) { add_closure(dict,"sysbuffer",buffer_apply); } + +void update_max_start_pad(int32_t *our_module_global, int32_t our_instance) +{ + if (*our_module_global < our_instance) + *our_module_global=our_instance; +} + +int32_t transform_max_start_pad, comm_max_start_pad; + +int32_t calculate_max_start_pad(void) +{ + return + site_max_start_pad + + transform_max_start_pad + + comm_max_start_pad; +}