New test.
[mono.git] / mono / wrapper / wrapper.c
index 1d24e96e389ffbab335c185c5f148b23ea0f49f1..6ad29668e0407ebf14003cec9e46f62bd709e9ba 100644 (file)
@@ -6,7 +6,9 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/types.h>
+#ifdef HAVE_UTIME_H
 #include <utime.h>
+#endif
 #include "wrapper.h"
 
 extern char **environ;
@@ -54,15 +56,15 @@ mono_wrapper_fstat (gpointer fd, MonoWrapperStat* buf)
        if (fstat ((int)fd, &fs) == -1)
                return -errno;
 
-       buf->st_dev = fs.st_dev;
-       buf->st_mode = fs.st_mode;
-       buf->st_nlink = fs.st_nlink;
-       buf->st_uid = fs.st_uid;
-       buf->st_gid = fs.st_gid;
-       buf->st_size = fs.st_size;
-       buf->st_atime = fs.st_atime;
-       buf->st_mtime = fs.st_ctime;
-       buf->st_ctime = fs.st_ctime;
+       buf->mst_dev = fs.st_dev;
+       buf->mst_mode = fs.st_mode;
+       buf->mst_nlink = fs.st_nlink;
+       buf->mst_uid = fs.st_uid;
+       buf->mst_gid = fs.st_gid;
+       buf->mst_size = fs.st_size;
+       buf->mst_atime = fs.st_atime;
+       buf->mst_mtime = fs.st_mtime;
+       buf->mst_ctime = fs.st_ctime;
 
        return 0;
 }
@@ -101,15 +103,15 @@ mono_wrapper_stat (const char * path, MonoWrapperStat* buf)
        if (stat (path, &fs) != 0)
                return errno;
 
-       buf->st_dev = fs.st_dev;
-       buf->st_mode = fs.st_mode;
-       buf->st_nlink = fs.st_nlink;
-       buf->st_uid = fs.st_uid;
-       buf->st_gid = fs.st_gid;
-       buf->st_size = fs.st_size;
-       buf->st_atime = fs.st_atime;
-       buf->st_mtime = fs.st_ctime;
-       buf->st_ctime = fs.st_ctime;
+       buf->mst_dev = fs.st_dev;
+       buf->mst_mode = fs.st_mode;
+       buf->mst_nlink = fs.st_nlink;
+       buf->mst_uid = fs.st_uid;
+       buf->mst_gid = fs.st_gid;
+       buf->mst_size = fs.st_size;
+       buf->mst_atime = fs.st_atime;
+       buf->mst_mtime = fs.st_mtime;
+       buf->mst_ctime = fs.st_ctime;
 
        return 0;
 }
@@ -135,9 +137,6 @@ mono_wrapper_readdir (gpointer dir)
 
        p = readdir((DIR*)dir);
 
-       // fixme: ugly hack - remove this code ASAP
-       return mono_string_new (p);
-
        return p != NULL ? p->d_name : NULL;
 }
 
@@ -162,8 +161,10 @@ mono_wrapper_environ ()
 int
 mono_wrapper_mkdir (const char *path, int mode)
 {
+#ifndef PLATFORM_WIN32
        if (mkdir (path, mode) == -1)
                return -errno;
+#endif
        return 0;
 }
 
@@ -186,6 +187,7 @@ mono_wrapper_rename (const char *src, const char *dst)
 int
 mono_wrapper_utime (const char *path, int atime, int mtime)
 {
+#ifndef PLATFORM_WIN32
        struct utimbuf buf;
 
        buf.actime = atime;
@@ -193,6 +195,7 @@ mono_wrapper_utime (const char *path, int atime, int mtime)
 
        if (utime (path, &buf) == -1)
                return -errno;
+#endif
        return 0;
 }