]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
ras-events: Fix the logic that retrieves the debugfs mount point
authorMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 24 May 2013 09:18:54 +0000 (06:18 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 24 May 2013 09:18:54 +0000 (06:18 -0300)
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>
ras-events.c

index f97a62e337c0451ed7398df930e77fa2a32844b6..b46a7c3ef6abf1090615e1542e1a2d6e8e24a46d 100644 (file)
@@ -51,7 +51,7 @@ static int get_debugfs_dir(char *tracing_dir, size_t len)
 {
        FILE *fp;
        char line[MAX_PATH + 1 + 256];
-       char *type, *dir;
+       char *p, *type, *dir;
 
        fp = fopen("/proc/mounts","r");
        if (!fp) {
@@ -63,14 +63,18 @@ static int get_debugfs_dir(char *tracing_dir, size_t len)
                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);