static int perf_event__get_comm_ids(pid_t pid, char *comm, size_t len,
                                    pid_t *tgid, pid_t *ppid)
 {
-       char filename[PATH_MAX];
        char bf[4096];
        int fd;
        size_t size = 0;
        *tgid = -1;
        *ppid = -1;
 
-       snprintf(filename, sizeof(filename), "/proc/%d/status", pid);
+       snprintf(bf, sizeof(bf), "/proc/%d/status", pid);
 
-       fd = open(filename, O_RDONLY);
+       fd = open(bf, O_RDONLY);
        if (fd < 0) {
-               pr_debug("couldn't open %s\n", filename);
+               pr_debug("couldn't open %s\n", bf);
                return -1;
        }
 
                                       struct machine *machine,
                                       bool mmap_data)
 {
-       char filename[PATH_MAX];
        FILE *fp;
        unsigned long long t;
+       char bf[BUFSIZ];
        bool truncation = false;
        unsigned long long timeout = proc_map_timeout * 1000000ULL;
        int rc = 0;
        if (machine__is_default_guest(machine))
                return 0;
 
-       snprintf(filename, sizeof(filename), "%s/proc/%d/task/%d/maps",
-                machine->root_dir, pid, pid);
+       snprintf(bf, sizeof(bf), "%s/proc/%d/task/%d/maps",
+               machine->root_dir, pid, pid);
 
-       fp = fopen(filename, "r");
+       fp = fopen(bf, "r");
        if (fp == NULL) {
                /*
                 * We raced with a task exiting - just return:
                 */
-               pr_debug("couldn't open %s\n", filename);
+               pr_debug("couldn't open %s\n", bf);
                return -1;
        }
 
        t = rdclock();
 
        while (1) {
-               char bf[BUFSIZ];
                char prot[5];
                char execname[PATH_MAX];
                char anonstr[] = "//anon";
                        break;
 
                if ((rdclock() - t) > timeout) {
-                       pr_warning("Reading %s time out. "
+                       pr_warning("Reading %s/proc/%d/task/%d/maps time out. "
                                   "You may want to increase "
                                   "the time limit by --proc-map-timeout\n",
-                                  filename);
+                                  machine->root_dir, pid, pid);
                        truncation = true;
                        goto out;
                }