diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-09-06 11:31:59 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:17:44 -0500 |
commit | 3ca73facc59ed8a97abbc28c1b4bedde87e109a6 (patch) | |
tree | 6959d7d7e546cf8be7e57eb9bcd1cdfb1170b412 /source4/lib/replace/replace.c | |
parent | d093b28b55bac53c32cf3bf35424ca967b55bfc5 (diff) | |
download | samba-3ca73facc59ed8a97abbc28c1b4bedde87e109a6.tar.gz samba-3ca73facc59ed8a97abbc28c1b4bedde87e109a6.tar.bz2 samba-3ca73facc59ed8a97abbc28c1b4bedde87e109a6.zip |
r18160: - pread and pwrite replacements need to be non-static
- replacing rename() is pointless - all platforms have it (and the
#define of rename breaks some code)
- use system/locale.h in snprintf.c
- fix passwd.h for initgroups
- stdlib is in replace.h, not needed elsewhere
- fix the initgroups replacement
- fix mapping of dl functions to rep_*
(This used to be commit 57cd0ca176387d6a3acabf9fedeef4f2a3a3dad7)
Diffstat (limited to 'source4/lib/replace/replace.c')
-rw-r--r-- | source4/lib/replace/replace.c | 29 |
1 files changed, 7 insertions, 22 deletions
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; |