While on Fedora/RHEL the mount device for debugfs is called "debugfs",
it is usual to use "none" on some other distros or for manually
mounted debugfs.
So, fix the logic to look at the filesystem type, instead, as it should
always be "debugfs", on both cases.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
{
FILE *fp;
char line[MAX_PATH + 1 + 256];
- char *type, *dir;
+ char *p, *type, *dir;
fp = fopen("/proc/mounts","r");
if (!fp) {
if (!fgets(line, sizeof(line), fp))
break;
- type = strtok(line, " \t");
- if (!type)
+ p = strtok(line, " \t");
+ if (!p)
break;
dir = strtok(NULL, " \t");
if (!dir)
break;
+ type = strtok(NULL, " \t");
+ if (!type)
+ break;
+
if (!strcmp(type, "debugfs")) {
fclose(fp);
strncpy(tracing_dir, dir, len - 1);