02e0cdf569
the latter works on the most current NetBSD, I don't feel like running file systems unnecessarily as the superuser
58 lines
1.4 KiB
Text
58 lines
1.4 KiB
Text
$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;
|