X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/950ab32d38ab6ed1940ba58ff250d414e9db4708..feaa89c410544775afc19eac4a966e8345d5134a:/util.c diff --git a/util.c b/util.c index d04a2173..927aa996 100644 --- a/util.c +++ b/util.c @@ -82,9 +82,9 @@ char *map_ptr(struct map_struct *map,off_t offset,int len) if (lseek(map->fd,offset,SEEK_SET) != offset || (nread=read(map->fd,map->p,len)) != len) { - fprintf(FERROR,"EOF in map_ptr! (offset=%d len=%d nread=%d errno=%d)\n", - (int)offset, len, nread, errno); - exit_cleanup(1); + fprintf(FERROR,"EOF in map_ptr! (offset=%d len=%d nread=%d errno=%d)\n", + (int)offset, len, nread, errno); + exit_cleanup(1); } map->p_offset = offset; @@ -164,21 +164,10 @@ void out_of_memory(char *str) } -#ifndef HAVE_STRDUP - char *strdup(char *s) -{ - int l = strlen(s) + 1; - char *ret = (char *)malloc(l); - if (ret) - strcpy(ret,s); - return ret; -} -#endif - int set_modtime(char *fname,time_t modtime) { -#ifdef HAVE_UTIME_H +#ifdef HAVE_UTIMBUF struct utimbuf tbuf; tbuf.actime = time(NULL); tbuf.modtime = modtime; @@ -353,3 +342,13 @@ int copy_file(char *source, char *dest, mode_t mode) return 0; } + +/* sleep for a while via select */ +void u_sleep(int usec) +{ + struct timeval tv; + + tv.tv_sec = 0; + tv.tv_usec = usec; + select(0, NULL, NULL, NULL, &tv); +}