Whamcloud - gitweb
b=20668
[fs/lustre-release.git] / libsysio / drivers / native / fs_native.c
index 8f8f91a..7980f68 100644 (file)
@@ -56,7 +56,7 @@
 #endif
 #include <errno.h>
 #include <assert.h>
-#include <syscall.h>
+#include <sys/syscall.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -875,9 +875,11 @@ native_inop_setattr(struct pnode *pno,
                /*
                 * Do the truncate last. It can't be undone.
                 */
-                (void )(fd < 0
+                err = fd < 0
                           ? syscall(SYSIO_SYS_truncate, path, stat->st_size)
-                          : syscall(SYSIO_SYS_ftruncate, fd, stat->st_size));
+                          : syscall(SYSIO_SYS_ftruncate, fd, stat->st_size);
+               if (err)
+                       err = -errno;
        }
        if (!err)
                goto out;
@@ -931,7 +933,7 @@ native_pos(int fd, _SYSIO_OFF_T *offset, int whence)
        assert(*offset >= 0);
 
        off = *offset;
-#if _LARGEFILE64_SOURCE && defined(SYSIO_SYS__llseek)
+#if defined(_LARGEFILE64_SOURCE) && defined(SYSIO_SYS__llseek)
        {
                int     err;
                err =
@@ -967,7 +969,7 @@ native_ifilldirentries(struct native_inode *nino,
        int     err;
        ssize_t cc;
 #if defined(SYSIO_SYS_getdirentries)
-       _SYSIO_OFF_T    waste;
+       _SYSIO_OFF_T    waste=*posp;
 #endif
 
        if (*posp < 0)