first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
[kai/samba.git] / source / smbwrapper / wrapped.c
index 129e9afe8423cde9fd1069f59ba031a4f1720926..1b356e6a26defa186dfe58ae7e91e4002329fe9a 100644 (file)
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* NOTE: This file WILL produce compiler warnings. They are unavoidable */
+/* NOTE: This file WILL produce compiler warnings. They are unavoidable 
+
+   Do not try and get rid of them by including other include files or
+   by including includes.h or proto.h or you will break portability. 
+  */
 
 #include "config.h"
 #include <sys/types.h>
 #include <errno.h>
 #include "realcalls.h"
 
+#ifndef NULL
+# define NULL ((void *)0)
+#endif
+
  int open(char *name, int flags, mode_t mode)
 {
        if (smbw_path(name)) {
        if (smbw_fd(fd)) {
                return smbw_close(fd);
        }
+       if (smbw_local_fd(fd)) {
+               errno = EBADF;
+               return -1;
+       }
 
        return real_close(fd);
 }
 
  int fchdir(int fd)
 {
-       if (smbw_fd(fd)) {
-               return smbw_fchdir(fd);
-       }
-
-       return real_fchdir(fd);
+       return smbw_fchdir(fd);
 }
 
 #ifdef HAVE___FCHDIR
 #if HAVE___FXSTAT
  int __fxstat(int vers, int fd, void *st)
 {
-       long xx[32];
+       double xx[32];
        int ret;
 
        if (smbw_fd(fd)) {
 #if HAVE___XSTAT
  int __xstat(int vers, char *name, void *st)
 {
-       long xx[32];
+       double xx[32];
        int ret;
 
        if (smbw_path(name)) {
 #if HAVE___LXSTAT
  int __lxstat(int vers, char *name, void *st)
 {
-       long xx[32];
+       double xx[32];
        int ret;
 
        if (smbw_path(name)) {
   int stat64(char *name, void *st64)
 {
        if (smbw_path(name)) {
-               long xx[32];
+               double xx[32];
                int ret = stat(name, xx);
                stat64_convert(xx, st64);
                return ret;
   int fstat64(int fd, void *st64)
 {
        if (smbw_fd(fd)) {
-               long xx[32];
+               double xx[32];
                int ret = fstat(fd, xx);
                stat64_convert(xx, st64);
                return ret;
   int lstat64(char *name, void *st64)
 {
        if (smbw_path(name)) {
-               long xx[32];
+               double xx[32];
                int ret = lstat(name, xx);
                stat64_convert(xx, st64);
                return ret;
  void *readdir64(void *dir)
 {
        if (smbw_dirp(dir)) {
-               static long xx[70];
+               static double xx[70];
                void *d;
                d = (void *)readdir(dir);
                if (!d) return NULL;