summaryrefslogtreecommitdiff
path: root/filesystems/fuse-archivemount/patches/patch-ab
blob: 6561b8a556bd260d506373f345f12ce05fcf536f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
$NetBSD: patch-ab,v 1.2 2007/02/21 00:04:30 pooka Exp $

--- archivemount.c.orig	2006-12-28 17:32:47.000000000 +0200
+++ archivemount.c	2007-02-21 02:02:55.000000000 +0200
@@ -31,7 +31,11 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <errno.h>
+#ifdef HAVE_STATVFS
+#include <sys/statvfs.h>
+#else
 #include <sys/statfs.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <time.h>
@@ -1449,11 +1453,24 @@
 		return tmp;
 	}
 	/* create temp file */
-	if( mknod( location, mode, rdev ) == -1 ) {
-		log( "Could not create temporary file %s: %s",
-				location, strerror( errno ) );
-		free( location );
-		return 0 - errno;
+	if( S_ISREG(mode) ) {
+		int fd;
+
+		if( fd = ( open( location, O_WRONLY | O_CREAT | O_EXCL,
+				mode) == -1 ) ) {
+			log( "Could not create temporary file %s: %s",
+					location, strerror( errno ) );
+			free( location );
+			return 0 - errno;
+		}
+		close( fd );
+	} else {
+		if( mknod( location, mode, rdev ) == -1 ) {
+			log( "Could not create temporary file %s: %s",
+					location, strerror( errno ) );
+			free( location );
+			return 0 - errno;
+		}
 	}
 	/* build node */
 	node = ( NODE * )malloc( sizeof( NODE ) );
@@ -1605,7 +1622,11 @@
 }
 
 static int
+#ifdef HAVE_STATVFS
+ar_statfs( const char *path, struct statvfs *stbuf )
+#else
 ar_statfs( const char *path, struct statfs *stbuf )
+#endif
 {
 	/* ENOSYS is ok for this, we have no statistics */
 	( void )path;