summaryrefslogtreecommitdiff
path: root/filesystems/fuse-mp3fs/patches/patch-aa
blob: 3955f3d3a212ff600537b58fd182266d0d2b000a (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
$NetBSD: patch-aa,v 1.5 2014/11/26 22:31:41 wiz Exp $

--- src/mp3fs.c.orig	2008-12-14 06:17:35.000000000 +0100
+++ src/mp3fs.c
@@ -30,7 +30,11 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <errno.h>
+#if defined (__NetBSD__) || defined (__DragonFly__)
+#include <sys/statvfs.h>
+#else
 #include <sys/statfs.h>
+#endif
 
 #include "transcode.h"
 #include "talloc.h"
@@ -195,7 +199,12 @@ static int mp3fs_read(const char *path, 
   return f->Read(f, buf, offset, size);
 }
 
-static int mp3fs_statfs(const char *path, struct statfs *stbuf) {
+#if defined (__NetBSD__) || defined (__DragonFly__)
+static int mp3fs_statfs(const char *path, struct statvfs *stbuf)
+#else
+static int mp3fs_statfs(const char *path, struct statfs *stbuf)
+#endif
+{
   int res;
   char name[256];
 
@@ -204,7 +213,11 @@ static int mp3fs_statfs(const char *path
   strncpy(name, basepath, sizeof(name));
   strncat(name, path, sizeof(name) - strlen(name));
 
+#if defined (__NetBSD__) || defined (__DragonFly__)
+  res = statvfs(name, stbuf);
+#else
   res = statfs(name, stbuf);
+#endif
   if(res == -1)
     return -errno;
   
@@ -252,7 +265,7 @@ int main(int argc, char *argv[]) {
   basepath = argv[1];
   bitrate = 0;
 
-  rate = strchr(basepath, ',');
+  rate = strrchr(basepath, ',');
   if(rate) {
     rate[0] = '\0';
     bitrate = atoi(rate + 1);