Fix build failure on modern NetBSD.

This commit is contained in:
David Howland 2008-03-08 19:57:00 +00:00 committed by Thomas Klausner
parent f96a3bcbdb
commit 14022ede6c
2 changed files with 42 additions and 8 deletions

View file

@ -1,8 +1,8 @@
$NetBSD: distinfo,v 1.2 2005/09/28 06:41:30 rillig Exp $
$NetBSD: distinfo,v 1.3 2008/03/08 19:57:00 dhowland Exp $
SHA1 (mtf-0.2.1.tgz) = 6b4deec089ab87a8bab7409b6860ac1de6a1a7f5
RMD160 (mtf-0.2.1.tgz) = 70a9477d0367e742c51e7d968b16791945b882ad
Size (mtf-0.2.1.tgz) = 24188 bytes
SHA1 (patch-aa) = a27f72f23ad84ba82b05d1d7e65b4814a933b965
SHA1 (patch-ab) = 6803e5443915ecd1c64930da5a8a91f9a4b8750f
SHA1 (patch-ac) = 4f843b9c956128b8c1540c3bdd69a10655cd49b3
SHA1 (patch-ac) = db6b4a85308322ab8bb43c2eef053781b822b420

View file

@ -1,20 +1,22 @@
$NetBSD: patch-ac,v 1.1.1.1 2003/04/20 15:11:22 cjep Exp $
$NetBSD: patch-ac,v 1.2 2008/03/08 19:57:00 dhowland Exp $
--- mtfread.c.orig Wed Sep 13 16:14:33 2000
--- mtfread.c.orig 2000-09-13 11:14:33.000000000 -0400
+++ mtfread.c
@@ -42,7 +42,11 @@ See mtf.c for version history, contribut
@@ -42,7 +42,13 @@ See mtf.c for version history, contribut
#include <limits.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
+#if defined(BSD)
+#if defined(__FreeBSD__)
+#include <sys/mount.h>
+#elif defined(__NetBSD__)
+#include <sys/statvfs.h>
+#else
#include <sys/vfs.h>
+#endif
#include <utime.h>
#include <unistd.h>
#include <time.h>
@@ -363,7 +367,7 @@ INT32 readTapeBlock(void)
@@ -363,7 +369,7 @@ INT32 readTapeBlock(void)
{
stream = (MTF_STREAM_HDR*) ((char*) tape + dbHdr->off);
result = skipToNextBlock();
@ -23,7 +25,7 @@ $NetBSD: patch-ac,v 1.1.1.1 2003/04/20 15:11:22 cjep Exp $
{
fprintf(stderr, "Error traversing to end of descriptor block!\n");
return(-1);
@@ -671,7 +675,8 @@ INT32 readFileBlock(void)
@@ -671,11 +677,16 @@ INT32 readFileBlock(void)
INT32 result;
char *ptr, *ptr2, filePath[MAXPATHLEN + 1], fullPath[MAXPATHLEN + 1];
char tmpPath[MAXPATHLEN + 1];
@ -33,3 +35,35 @@ $NetBSD: patch-ac,v 1.1.1.1 2003/04/20 15:11:22 cjep Exp $
struct tm tbuf;
struct utimbuf utbuf;
UINT32 threshold;
+#if defined(__NetBSD__)
+ struct statvfs fsbuf;
+#else
struct statfs fsbuf;
+#endif
struct stat sbuf;
if (verbose > 1)
@@ -864,7 +875,11 @@ INT32 readFileBlock(void)
ptr = strrchr(filePath, '/');
*ptr = '\0';
+#if defined(__NetBSD__)
+ if (statvfs(filePath, &fsbuf) != 0)
+#else
if (statfs(filePath, &fsbuf) != 0)
+#endif
{
if (debug > 0) printf("filePath=%s\n", filePath);
fprintf(stderr, "Error testing for free space!\n");
@@ -883,7 +898,11 @@ INT32 readFileBlock(void)
fsbuf.f_bavail * fsbuf.f_bsize);
sleep(60);
+#if defined(__NetBSD__)
+ if (statvfs(filePath, &fsbuf) != 0)
+#else
if (statfs(filePath, &fsbuf) != 0)
+#endif
{
fprintf(stderr, "Error testing for free space!\n");
return(-1);