]> andersk Git - openssh.git/blobdiff - openbsd-compat/bsd-misc.c
- markus@cvs.openbsd.org 2002/06/08 05:07:56
[openssh.git] / openbsd-compat / bsd-misc.c
index bce60358eaa3970948cfba00ece47e61b474cc85..dae90122b0137955cb28d6c7b43adbaad7362de9 100644 (file)
@@ -23,8 +23,6 @@
  */
 
 #include "includes.h"
-#include "xmalloc.h"
-#include "ssh.h"
 
 RCSID("$Id$");
 
@@ -101,3 +99,22 @@ int utimes(char *filename, struct timeval *tvp)
        return(utime(filename, &ub));
 }
 #endif 
+
+#ifndef HAVE_TRUNCATE
+int truncate (const char *path, off_t length)
+{
+       int fd, ret, saverrno;
+
+       fd = open(path, O_WRONLY);
+       if (fd < 0)
+               return -1;
+
+       ret = ftruncate(fd, length);
+       saverrno = errno;
+       (void) close (fd);
+       if (ret == -1)
+               errno = saverrno;
+       return(ret);
+}
+#endif /* HAVE_TRUNCATE */
+
This page took 0.034059 seconds and 4 git commands to generate.