projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into windows
[ardour.git]
/
libs
/
pbd
/
mountpoint.cc
diff --git
a/libs/pbd/mountpoint.cc
b/libs/pbd/mountpoint.cc
index a4063a0e4081d02fc1b84074d82b77afd26ede9b..65f011c745efa0de2f005366d3de4214985073ee 100644
(file)
--- a/
libs/pbd/mountpoint.cc
+++ b/
libs/pbd/mountpoint.cc
@@
-17,22
+17,22
@@
$Id$
*/
$Id$
*/
-
+#ifndef COMPILER_MSVC
#include <cstdio>
#include <cstring>
#include <string>
#include <cstring>
#include <limits.h>
#include <cstdio>
#include <cstring>
#include <string>
#include <cstring>
#include <limits.h>
-#include
<pbd/mountpoint.h>
+#include
"pbd/mountpoint.h"
using std::string;
using std::string;
-#ifdef
HAVE_WAFCONFIG_H
-#include "
waf
config.h"
+#ifdef
WAF_BUILD
+#include "
libpbd-
config.h"
#endif
#endif
-#if HAVE_GETMNTENT
+#if
def
HAVE_GETMNTENT
#include <mntent.h>
struct mntent_sorter {
#include <mntent.h>
struct mntent_sorter {
@@
-94,6
+94,14
@@
mountpoint (string path)
return best;
}
return best;
}
+#elif defined(PLATFORM_WINDOWS)
+
+string
+mountpoint (string path)
+{
+ // TODO ... if needed
+}
+
#else // !HAVE_GETMNTENT
#include <sys/param.h>
#else // !HAVE_GETMNTENT
#include <sys/param.h>
@@
-110,8
+118,13
@@
mountpoint (string path)
const char *cpath = path.c_str();
char best[PATH_MAX+1];
const char *cpath = path.c_str();
char best[PATH_MAX+1];
+ /* From the manpage, under "BUGS" : "The memory allocated by getmntinfo() cannot be free(3)'d by the
+ application."
+
+ Thus: we do NOT try to free memory allocated by getmntinfo()
+ */
+
if ((count = getmntinfo(&mntbufp, MNT_NOWAIT)) == 0) {
if ((count = getmntinfo(&mntbufp, MNT_NOWAIT)) == 0) {
- free(mntbufp);
return "\0";
}
return "\0";
}
@@
-135,7
+148,6
@@
mountpoint (string path)
if (cpath[matchlen] == '\0') {
snprintf(best, sizeof(best), "%s", mntbufp[i].f_mntonname);
if (cpath[matchlen] == '\0') {
snprintf(best, sizeof(best), "%s", mntbufp[i].f_mntonname);
- free(mntbufp);
return best;
} else {
return best;
} else {
@@
-146,8
+158,6
@@
mountpoint (string path)
}
}
}
}
}
}
-
- free(mntbufp);
return best;
}
return best;
}
@@
-162,3
+172,7
@@
main (int argc, char *argv[])
}
#endif // TEST_MOUNTPOINT
}
#endif // TEST_MOUNTPOINT
+
+#else // COMPILER_MSVC
+ const char* pbd_mountpoint = "pbd/msvc/mountpoint.cc takes precedence over this file";
+#endif // COMPILER_MSVC