- struct mntent *m;
-
- while ((m = getmntent(mntentfile)) != NULL) {
- if (strcmp(m->mnt_dir, path) == 0) {
- mounted = true;
- break;
+ if (mntentfile == NULL) {
+ mntentfile = setmntent("/proc/mounts", "r");
+ }
+ if (mntentfile == NULL) {
+ fprintf(stderr, "i3status: files /etc/mtab and /proc/mounts aren't accessible\n");
+ } else {
+ struct mntent *m;
+
+ while ((m = getmntent(mntentfile)) != NULL) {
+ if (strcmp(m->mnt_dir, sanitized) == 0) {
+ mounted = true;
+ break;
+ }