X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=lib%2Fdropin.c;h=a500a0348a8cca2711feceeef6d5550b00f4d1fd;hp=9de5c2c593daccdd4e515c60fb06cc455c1a395b;hb=7608136a8dae24f2df30eac8644efd0d7cd57dc9;hpb=f777c1807d663eaef3e36c395094451214886898 diff --git a/lib/dropin.c b/lib/dropin.c index 9de5c2c5..a500a034 100644 --- a/lib/dropin.c +++ b/lib/dropin.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: dropin.c,v 1.1.2.4 2001/02/06 10:12:51 guus Exp $ + $Id: dropin.c,v 1.1.2.9 2002/06/09 15:26:10 zarq Exp $ */ #include "config.h" @@ -27,12 +27,16 @@ #include #include #include +#include +#include #include #include #include +#include "fake-getnameinfo.c" + #ifndef HAVE_DAEMON /* Replacement for the daemon() function. @@ -96,6 +100,8 @@ int daemon(int nochdir, int noclose) dup2(fd, 2); } } + + return 0; } #endif @@ -136,3 +142,32 @@ char *get_current_dir_name(void) return buf; } #endif + +#ifndef HAVE_ASPRINTF +int asprintf(char **buf, const char *fmt, ...) +{ + int status; + va_list ap; + int len; + + len = 4096; + *buf = xmalloc(len); + + va_start(ap, fmt); + status = vsnprintf (*buf, len, fmt, ap); + va_end (ap); + + if(status >= 0) + *buf = xrealloc(*buf, status); + + if(status > len-1) + { + len = status; + va_start(ap, fmt); + status = vsnprintf (*buf, len, fmt, ap); + va_end (ap); + } + + return status; +} +#endif