parent
37e73e77b0
commit
27952b11f7
@ -141,16 +141,20 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch
|
||||
* we consider the device not mounted. */
|
||||
mounted = false;
|
||||
} else {
|
||||
char *sanitized = sstrdup(path);
|
||||
if (sanitized[strlen(sanitized) - 1] == '/')
|
||||
sanitized[strlen(sanitized) - 1] = '\0';
|
||||
FILE *mntentfile = setmntent("/etc/mtab", "r");
|
||||
struct mntent *m;
|
||||
|
||||
while ((m = getmntent(mntentfile)) != NULL) {
|
||||
if (strcmp(m->mnt_dir, path) == 0) {
|
||||
if (strcmp(m->mnt_dir, sanitized) == 0) {
|
||||
mounted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
endmntent(mntentfile);
|
||||
free(sanitized);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user