From 002a9fe6342c1d62f273634db484ac93db647ca9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Oct 1998 05:58:09 +0000 Subject: - no getdents on OSF1 - try a new method of handling prototype mismatches in wrapped.c. We now try to disable prototypes! (This used to be commit 77aea37bb83f2b9ad541f851b003ca10b9811314) --- source3/configure | 4 +-- source3/configure.in | 4 +-- source3/include/config.h.in | 6 +++++ source3/smbwrapper/wrapped.c | 61 ++++++++------------------------------------ source3/smbwrapper/wrapper.h | 14 ++++++++++ 5 files changed, 35 insertions(+), 54 deletions(-) (limited to 'source3') diff --git a/source3/configure b/source3/configure index adeda77b41..028fd7bdb9 100755 --- a/source3/configure +++ b/source3/configure @@ -1940,7 +1940,7 @@ else fi done -for ac_hdr in sys/acl.h +for ac_hdr in sys/acl.h sys/cdefs.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -4352,7 +4352,7 @@ else fi done -for ac_func in _getdents __getdents _lseek __lseek _read __read +for ac_func in getdents _getdents __getdents _lseek __lseek _read __read do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:4359: checking for $ac_func" >&5 diff --git a/source3/configure.in b/source3/configure.in index 4f549bcf1d..276e3847b8 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -62,7 +62,7 @@ AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h) AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h) AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h) AC_CHECK_HEADERS(readline/history.h sys/capability.h sysacll.h sys/syscall.h) -AC_CHECK_HEADERS(sys/acl.h) +AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h) AC_CHECK_SIZEOF(int,cross) AC_CHECK_SIZEOF(long,cross) @@ -194,7 +194,7 @@ AC_CHECK_FUNCS(__xstat __fxstat __lxstat) AC_CHECK_FUNCS(_stat _lstat _fstat __stat __lstat __fstat) AC_CHECK_FUNCS(_acl __acl _facl __facl _open __open _chdir __chdir) AC_CHECK_FUNCS(_close __close _fchdir __fchdir _fcntl __fcntl) -AC_CHECK_FUNCS(_getdents __getdents _lseek __lseek _read __read) +AC_CHECK_FUNCS(getdents _getdents __getdents _lseek __lseek _read __read) AC_CHECK_FUNCS(_write __write _fork __fork) AC_CHECK_FUNCS(_stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64) AC_CHECK_FUNCS(llseek _llseek __llseek readdir64 _readdir64 __readdir64) diff --git a/source3/include/config.h.in b/source3/include/config.h.in index 92056f075a..289f06f0a2 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -408,6 +408,9 @@ /* Define if you have the getcwd function. */ #undef HAVE_GETCWD +/* Define if you have the getdents function. */ +#undef HAVE_GETDENTS + /* Define if you have the getgrnam function. */ #undef HAVE_GETGRNAM @@ -654,6 +657,9 @@ /* Define if you have the header file. */ #undef HAVE_SYS_CAPABILITY_H +/* Define if you have the header file. */ +#undef HAVE_SYS_CDEFS_H + /* Define if you have the header file. */ #undef HAVE_SYS_DIR_H diff --git a/source3/smbwrapper/wrapped.c b/source3/smbwrapper/wrapped.c index 10b22b35dd..cf132b31e3 100644 --- a/source3/smbwrapper/wrapped.c +++ b/source3/smbwrapper/wrapped.c @@ -20,17 +20,13 @@ */ +/* we don't want prototypes for this code */ +#define NO_PROTO + #include "wrapper.h" - int open(const char *name, int flags, ...) + int open(const char *name, int flags, mode_t mode) { - va_list ap; - mode_t mode; - - va_start(ap, flags); - mode = va_arg(ap, mode_t); - va_end(ap); - if (smbw_path(name)) { return smbw_open(name, flags, mode); } @@ -39,27 +35,13 @@ } #ifdef HAVE__OPEN - int _open(const char *name, int flags, ...) + int _open(const char *name, int flags, mode_t mode) { - va_list ap; - mode_t mode; - - va_start(ap, flags); - mode = va_arg(ap, mode_t); - va_end(ap); - return open(name, flags, mode); } #elif HAVE___OPEN - int __open(const char *name, int flags, ...) + int __open(const char *name, int flags, mode_t mode) { - va_list ap; - mode_t mode; - - va_start(ap, flags); - mode = va_arg(ap, mode_t); - va_end(ap); - return open(name, flags, mode); } #endif @@ -197,14 +179,8 @@ #endif - int fcntl(int fd, int cmd, ...) + int fcntl(int fd, int cmd, long arg) { - va_list ap; - long arg; - va_start(ap, cmd); - arg = va_arg(ap, long); - va_end(ap); - if (smbw_fd(fd)) { return smbw_fcntl(fd, cmd, arg); } @@ -214,31 +190,20 @@ #ifdef HAVE___FCNTL - int __fcntl(int fd, int cmd, ...) + int __fcntl(int fd, int cmd, long arg) { - va_list ap; - long arg; - va_start(ap, cmd); - arg = va_arg(ap, long); - va_end(ap); - return fcntl(fd, cmd, arg); } #elif HAVE__FCNTL - int _fcntl(int fd, int cmd, ...) + int _fcntl(int fd, int cmd, long arg) { - va_list ap; - long arg; - va_start(ap, cmd); - arg = va_arg(ap, long); - va_end(ap); - return fcntl(fd, cmd, arg); } #endif +#ifdef HAVE_GETDENTS int getdents(int fd, struct dirent *dirp, unsigned int count) { if (smbw_fd(fd)) { @@ -247,6 +212,7 @@ return real_getdents(fd, dirp, count); } +#endif #ifdef HAVE___GETDENTS int __getdents(int fd, struct dirent *dirp, unsigned int count) @@ -628,12 +594,7 @@ #endif #ifdef HAVE_UTIMES -#if LINUX - /* glibc2 gets the prototype wrong */ - int utimes(const char *name,struct timeval tvp[2]) -#else int utimes(const char *name,const struct timeval tvp[2]) -#endif { if (smbw_path(name)) { return smbw_utimes(name, tvp); diff --git a/source3/smbwrapper/wrapper.h b/source3/smbwrapper/wrapper.h index 25694bd78c..3e7d754c9b 100644 --- a/source3/smbwrapper/wrapper.h +++ b/source3/smbwrapper/wrapper.h @@ -21,6 +21,20 @@ #include "config.h" +#ifdef NO_PROTO +/* get rid of prototypes */ +#define _NO_PROTO + +#ifdef HAVE_SYS_CDEFS_H +#include +#ifdef __P +#undef __P +#define __P(x) () +#endif +#endif +#endif + + #ifdef HAVE_SYSCALL_H #include #elif HAVE_SYS_SYSCALL_H -- cgit