diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index e1371c70648f1cc9ab3889bfc9f7892d390294cf..8dfc0fff2654a9d62f6430ebc128b854630e2ad3 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -787,9 +787,8 @@ static int jt_dbg_modules_2_5(int argc, char **argv) char *path = ""; char *kernel = "linux"; const char *proc = "/proc/modules"; - char modname[128], others[4096]; + char modname[128], buf[4096]; long modaddr; - int rc; FILE *file; if (argc >= 2) @@ -807,15 +806,17 @@ static int jt_dbg_modules_2_5(int argc, char **argv) return 0; } - while ((rc = fscanf(file, "%s %s %s %s %s %lx\n", - modname, others, others, others, others, &modaddr)) == 6) { - for (mp = mod_paths; mp->name != NULL; mp++) { - if (!strcmp(mp->name, modname)) - break; - } - if (mp->name) { - printf("add-symbol-file %s%s%s/%s.o 0x%0lx\n", path, - path[0] ? "/" : "", mp->path, mp->name, modaddr); + while (fgets(buf, sizeof(buf), file) != NULL) { + if (sscanf(buf, "%s %*s %*s %*s %*s %lx", modname, &modaddr) == 2) { + for (mp = mod_paths; mp->name != NULL; mp++) { + if (!strcmp(mp->name, modname)) + break; + } + if (mp->name) { + printf("add-symbol-file %s%s%s/%s.o 0x%0lx\n", + path, path[0] ? "/" : "", + mp->path, mp->name, modaddr); + } } }