mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-13 11:15:27 +00:00
fs.cc, linux.cc Use /proc/mounts for list of currently mounted fs (#357)
Per manpage of mount(1) in newer util-linux:
The programs mount and umount traditionally maintained a list of
currently mounted filesystems in the file /etc/mtab. This real mtab
file is still supported, but on current Linux systems it is better
to make it a symlink to /proc/mounts instead, because a regular mtab
file maintained in userspace cannot reliably work with namespaces,
containers and other advanced Linux features.
In most new Linux (e.g. Debian) /etc/mtab is already symlinked to
/proc/mounts.
See
e778642a9e
for the gory details.
This commit is contained in:
parent
2600d01373
commit
c6ef3ba5e7
@ -151,13 +151,13 @@ void get_fs_type(const char *path, char *result)
|
||||
#else /* HAVE_STRUCT_STATFS_F_FSTYPENAME */
|
||||
|
||||
struct mntent *me;
|
||||
FILE *mtab = setmntent("/etc/mtab", "r");
|
||||
FILE *mtab = setmntent("/proc/mounts", "r");
|
||||
char *search_path;
|
||||
int match;
|
||||
char *slash;
|
||||
|
||||
if (mtab == NULL) {
|
||||
NORM_ERR("setmntent /etc/mtab: %s", strerror(errno));
|
||||
NORM_ERR("setmntent /proc/mounts: %s", strerror(errno));
|
||||
strncpy(result, "unknown", DEFAULT_TEXT_BUFFER_SIZE);
|
||||
return;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ int check_mount(struct text_object *obj)
|
||||
if (!obj->data.s)
|
||||
return 0;
|
||||
|
||||
if ((mtab = fopen("/etc/mtab", "r"))) {
|
||||
if ((mtab = fopen("/proc/mounts", "r"))) {
|
||||
char buf1[256], buf2[129];
|
||||
|
||||
while (fgets(buf1, 256, mtab)) {
|
||||
|
Loading…
Reference in New Issue
Block a user