X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=lib%2Fdropin.c;h=1bad05cd43e6fee4c88937f0a69577741819aca6;hb=7cf68b5e35c002511cc7468967de6a75934cc998;hp=572617c6b841f031786a2ae36748a5494e9f3058;hpb=ab7c61b06f6c6e991225f2fcc32d02b8e1084aee;p=tinc diff --git a/lib/dropin.c b/lib/dropin.c index 572617c6..1bad05cd 100644 --- a/lib/dropin.c +++ b/lib/dropin.c @@ -36,8 +36,7 @@ Unless the argument noclose is non-zero, daemon() will redirect standard input, standard output and standard error to /dev/null. */ -int daemon(int nochdir, int noclose) -{ +int daemon(int nochdir, int noclose) { #ifdef HAVE_FORK pid_t pid; int fd; @@ -95,8 +94,7 @@ int daemon(int nochdir, int noclose) current directory name. If the environment variable PWD is set, and its value is correct, then that value will be returned. */ -char *get_current_dir_name(void) -{ +char *get_current_dir_name(void) { size_t size; char *buf; char *r; @@ -165,3 +163,11 @@ int gettimeofday(struct timeval *tv, void *tz) { return 0; } #endif + +#ifndef HAVE_USLEEP +int usleep(long usec) { + struct timeval tv = {usec / 1000000, (usec / 1000) % 1000}; + select(0, NULL, NULL, NULL, &tv); + return 0; +} +#endif