X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/c1b80c54fa4915bb7174dd4333e9ced40dfee770..cc5cd88d3e5d0ebc5ac7601d0bfb6374a196ecb4:/IkiWiki/Wrapper.pm diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 4c99cdaa0..69500029c 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -189,16 +189,23 @@ int i=0; void addenv(char *var, char *val) { char *s=malloc(strlen(var)+1+strlen(val)+1); - if (!s) + if (!s) { perror("malloc"); - sprintf(s, "%s=%s", var, val); - newenviron[i++]=s; + exit(1); + } + else { + sprintf(s, "%s=%s", var, val); + newenviron[i++]=s; + } } void set_cgilock_fd (int lockfd) { - char *fd_s=malloc(8); + char fd_s[12]; sprintf(fd_s, "%i", lockfd); - setenv("IKIWIKI_CGILOCK_FD", fd_s, 1); + if (setenv("IKIWIKI_CGILOCK_FD", fd_s, 1) != 0) { + perror("setenv"); + exit(1); + } } int main (int argc, char **argv) {