*/
#include <cstdio>
+#include <cstring>
#include <string>
+#include <cstring>
#include <limits.h>
-#include <pbd/mountpoint.h>
+#include "pbd/mountpoint.h"
using std::string;
-#if HAVE_GETMNTENT
+#ifdef WAF_BUILD
+#include "libpbd-config.h"
+#endif
+
+#ifdef HAVE_GETMNTENT
#include <mntent.h>
struct mntent_sorter {
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) {
- free(mntbufp);
return "\0";
}
if (cpath[matchlen] == '\0') {
snprintf(best, sizeof(best), "%s", mntbufp[i].f_mntonname);
- free(mntbufp);
return best;
} else {
}
}
}
-
- free(mntbufp);
return best;
}