Merge lp:~amdmi3/wargus/rip-music-freebsd into lp:wargus

Proposed by Dmitry Marakasov
Status: Merged
Approved by: Pali
Approved revision: 1890
Merged at revision: 1905
Proposed branch: lp:~amdmi3/wargus/rip-music-freebsd
Merge into: lp:wargus
Diff against target: 45 lines (+21/-1)
1 file modified
rip_music_unix.cpp (+21/-1)
To merge this branch: bzr merge lp:~amdmi3/wargus/rip-music-freebsd
Reviewer Review Type Date Requested Status
Stratagus Pending
Review via email: mp+258958@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'rip_music_unix.cpp'
--- rip_music_unix.cpp 2012-05-20 13:27:53 +0000
+++ rip_music_unix.cpp 2015-05-13 04:40:47 +0000
@@ -39,7 +39,12 @@
39#include <unistd.h>39#include <unistd.h>
40#include <libgen.h>40#include <libgen.h>
4141
42#include <mntent.h>42#if defined(__linux__)
43# include <mntent.h>
44#elif defined(__FreeBSD__)
45# include <sys/param.h>
46# include <sys/mount.h>
47#endif
4348
44#include "rip_music.h"49#include "rip_music.h"
4550
@@ -140,6 +145,7 @@
140145
141static char * find_dev(const char * mnt_dir) {146static char * find_dev(const char * mnt_dir) {
142147
148#if defined(__linux__)
143 struct mntent * mnt;149 struct mntent * mnt;
144 char * dev = NULL;150 char * dev = NULL;
145 FILE * file;151 FILE * file;
@@ -167,6 +173,20 @@
167 endmntent(file);173 endmntent(file);
168174
169 return dev;175 return dev;
176#elif defined(__FreeBSD__)
177 struct statfs sfs;
178
179 if ( statfs(mnt_dir, &sfs) != 0 ) {
180
181 fprintf(stderr, "Error: Cannot get mounted device: %s\n", strerror(errno));
182 return NULL;
183
184 }
185
186 return strdup(sfs.f_mntfromname);
187#else
188 return NULL;
189#endif
170190
171}191}
172192

Subscribers

People subscribed via source and target branches