diff options
-rw-r--r-- | memps.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -624,7 +624,7 @@ static int get_tmpfs_info(FILE *output_fp) { FILE *fp; char line[BUF_MAX]; - char tmpfs_mp[NAME_MAX]; /* tmpfs mount point */ + char *tmpfs_mp; /* tmpfs mount point */ struct statfs tmpfs_info; if (output_fp == NULL) @@ -639,7 +639,7 @@ static int get_tmpfs_info(FILE *output_fp) fprintf(output_fp, "TMPFS INFO\n"); while (fgets(line, BUF_MAX, fp) != NULL) { - if (sscanf(line, "tmpfs %s tmpfs", tmpfs_mp) == 1) { + if (sscanf(line, "tmpfs %ms tmpfs", &tmpfs_mp) == 1) { statfs(tmpfs_mp, &tmpfs_info); fprintf(output_fp, "tmpfs %16s Total %8ld KB, Used %8ld, Avail %8ld\n", @@ -648,6 +648,7 @@ static int get_tmpfs_info(FILE *output_fp) tmpfs_info.f_blocks * 4, (tmpfs_info.f_blocks - tmpfs_info.f_bfree) * 4, tmpfs_info.f_bfree * 4); + free(tmpfs_mp); } } fclose(fp); |