diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/replace/dlfcn.c | 3 | ||||
-rw-r--r-- | source4/lib/replace/getpass.c | 1 | ||||
-rw-r--r-- | source4/lib/replace/replace.c | 29 | ||||
-rw-r--r-- | source4/lib/replace/replace.h | 34 | ||||
-rw-r--r-- | source4/lib/replace/snprintf.c | 17 | ||||
-rw-r--r-- | source4/lib/replace/system/passwd.h | 5 | ||||
-rw-r--r-- | source4/lib/replace/test/testsuite.c | 7 | ||||
-rw-r--r-- | source4/lib/tdb/common/io.c | 22 |
8 files changed, 36 insertions, 82 deletions
diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 79005c0d2b..e25ac9dfe5 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -24,7 +24,6 @@ */ #include "replace.h" -#include <stdlib.h> #ifndef HAVE_DLOPEN void *dlopen(const char *name, int flags) @@ -41,7 +40,7 @@ void *dlsym(void *handle, const char *symbol) #endif #ifndef HAVE_DLERROR -const char *dlerror(void) +char *dlerror(void) { return "dynamic loading of objects not supported on this platform"; } diff --git a/source4/lib/replace/getpass.c b/source4/lib/replace/getpass.c index 05fb7976b9..2ccbf7b733 100644 --- a/source4/lib/replace/getpass.c +++ b/source4/lib/replace/getpass.c @@ -19,7 +19,6 @@ Cambridge, MA 02139, USA. */ /* Modified to use with samba by Jeremy Allison, 8th July 1995. */ #include "replace.h" -#include <stdlib.h> #if defined(HAVE_TERMIOS_H) /* POSIX terminal handling. */ diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index db07e49941..048ea3a998 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -30,6 +30,7 @@ #include "system/syslog.h" #include "system/network.h" #include "system/locale.h" +#include "system/wait.h" void replace_dummy(void); void replace_dummy(void) {} @@ -42,7 +43,7 @@ int rep_ftruncate(int f, off_t l) { #ifdef HAVE_CHSIZE return chsize(f,l); -#else +#elif defined(F_FREESP) struct flock fl; fl.l_whence = 0; @@ -50,6 +51,8 @@ int rep_ftruncate(int f, off_t l) fl.l_start = l; fl.l_type = F_WRLCK; return fcntl(f, F_FREESP, &fl); +#else +#error "you must have a ftruncate function" #endif } #endif /* HAVE_FTRUNCATE */ @@ -151,24 +154,6 @@ time_t rep_mktime(struct tm *t) #endif /* !HAVE_MKTIME */ - -#ifndef HAVE_RENAME -/* Rename a file. (from libiberty in GNU binutils) */ -int rep_rename(const char *zfrom, const char *zto) -{ - if (link (zfrom, zto) < 0) - { - if (errno != EEXIST) - return -1; - if (unlink (zto) < 0 - || link (zfrom, zto) < 0) - return -1; - } - return unlink (zfrom); -} -#endif /* HAVE_RENAME */ - - #ifndef HAVE_INNETGR #if defined(HAVE_SETNETGRENT) && defined(HAVE_GETNETGRENT) && defined(HAVE_ENDNETGRENT) /* @@ -211,7 +196,7 @@ int rep_initgroups(char *name, gid_t id) #include <grp.h> gid_t *grouplst = NULL; - int max_gr = groups_max(); + int max_gr = 32; int ret; int i,j; struct group *g; @@ -481,7 +466,7 @@ char *rep_mkdtemp(char *template) #endif #ifndef HAVE_PREAD -static ssize_t rep_pread(int __fd, void *__buf, size_t __nbytes, off_t __offset) +ssize_t rep_pread(int __fd, void *__buf, size_t __nbytes, off_t __offset) { if (lseek(__fd, __offset, SEEK_SET) != __offset) { return -1; @@ -491,7 +476,7 @@ static ssize_t rep_pread(int __fd, void *__buf, size_t __nbytes, off_t __offset) #endif #ifndef HAVE_PWRITE -static ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset) +ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset) { if (lseek(__fd, __offset, SEEK_SET) != __offset) { return -1; diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h index 38b4e08704..90fd994ca5 100644 --- a/source4/lib/replace/replace.h +++ b/source4/lib/replace/replace.h @@ -61,7 +61,6 @@ #include <strings.h> #endif - #ifndef HAVE_STRERROR extern char *sys_errlist[]; #define strerror(i) sys_errlist[i] @@ -121,11 +120,6 @@ size_t rep_strnlen(const char *s, size_t n); int rep_setenv(const char *name, const char *value, int overwrite); #endif -#ifndef HAVE_RENAME -#define rename rep_rename -int rep_rename(const char *zfrom, const char *zto); -#endif - #ifndef HAVE_STRCASESTR #define strcasestr rep_strcasestr char *rep_strcasestr(const char *haystack, const char *needle); @@ -148,13 +142,38 @@ unsigned long long int rep_strtoull(const char *str, char **endptr, int base); #ifndef HAVE_FTRUNCATE #define ftruncate rep_ftruncate -int rep_ftruncate(int f,long l); +int rep_ftruncate(int,off_t); +#endif + +#ifndef HAVE_INITGROUPS +#define ftruncate rep_ftruncate +int rep_initgroups(char *name, gid_t id); #endif #if !defined(HAVE_BZERO) && defined(HAVE_MEMSET) #define bzero(a,b) memset((a),'\0',(b)) #endif +#ifndef HAVE_DLERROR +#define dlerror rep_dlerror +char *rep_dlerror(void); +#endif + +#ifndef HAVE_DLOPEN +#define dlopen rep_dlopen +void *rep_dlopen(const char *name, int flags); +#endif + +#ifndef HAVE_DLSYM +#define dlsym rep_dlsym +void *rep_dlsym(void *handle, const char *symbol); +#endif + +#ifndef HAVE_DLCLOSE +#define dlclose rep_dlclose +int rep_dlclose(void *handle); +#endif + #ifndef PRINTF_ATTRIBUTE #if __GNUC__ >= 3 @@ -195,6 +214,7 @@ int rep_asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3); #ifndef HAVE_VA_COPY +#undef va_copy #ifdef HAVE___VA_COPY #define va_copy(dest, src) __va_copy(dest, src) #else diff --git a/source4/lib/replace/snprintf.c b/source4/lib/replace/snprintf.c index dd41ca3306..5416a9d3e2 100644 --- a/source4/lib/replace/snprintf.c +++ b/source4/lib/replace/snprintf.c @@ -104,6 +104,7 @@ **************************************************************/ #include "replace.h" +#include "system/locale.h" #ifdef TEST_SNPRINTF /* need math library headers for testing */ @@ -117,22 +118,6 @@ # include <math.h> #endif /* TEST_SNPRINTF */ -#ifdef HAVE_STRING_H -#include <string.h> -#endif - -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif -#ifdef HAVE_CTYPE_H -#include <ctype.h> -#endif -#include <sys/types.h> -#include <stdarg.h> -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - #if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) && defined(HAVE_C99_VSNPRINTF) /* only include stdio.h if we are not re-defining snprintf or vsnprintf */ #include <stdio.h> diff --git a/source4/lib/replace/system/passwd.h b/source4/lib/replace/system/passwd.h index 6f8d729a7c..21f31f0388 100644 --- a/source4/lib/replace/system/passwd.h +++ b/source4/lib/replace/system/passwd.h @@ -88,9 +88,4 @@ #define ULTRIX_AUTH 1 #endif - -#ifndef HAVE_INITGROUPS -int initgroups(char *name,gid_t id); -#endif - #endif diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c index ddc9550f61..33270d9a4a 100644 --- a/source4/lib/replace/test/testsuite.c +++ b/source4/lib/replace/test/testsuite.c @@ -120,12 +120,6 @@ static int test_mktime(void) return true; } -static int test_rename(void) -{ - /* FIXME */ - return true; -} - static int test_innetgr(void) { /* FIXME */ @@ -378,7 +372,6 @@ int torture_local_replace(void *ctx) ret &= test_strlcpy(); ret &= test_strlcat(); ret &= test_mktime(); - ret &= test_rename(); ret &= test_innetgr(); ret &= test_initgroups(); ret &= test_memmove(); diff --git a/source4/lib/tdb/common/io.c b/source4/lib/tdb/common/io.c index 21d591b67d..d0ef94831d 100644 --- a/source4/lib/tdb/common/io.c +++ b/source4/lib/tdb/common/io.c @@ -29,28 +29,6 @@ #include "tdb_private.h" -#ifndef HAVE_PREAD - static ssize_t pread(int fd, void *buf, size_t count, off_t offset) -{ - if (lseek(fd, offset, SEEK_SET) != offset) { - errno = EIO; - return -1; - } - return read(fd, buf, count); -} -#endif - -#ifndef HAVE_PWRITE - static ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) -{ - if (lseek(fd, offset, SEEK_SET) != offset) { - errno = EIO; - return -1; - } - return write(fd, buf, count); -} -#endif - /* check for an out of bounds access - if it is out of bounds then see if the database has been expanded by someone else and expand if necessary |