Kirill A. Shutemov wrote: > Fixed version of the patch in the attacment. Please, comment. [snip] > /* Look for path in emulation dir, otherwise return name. */ > const char *path(const char *name) > { > + char *newname = (char *) alloca(strlen(pref)+strlen(name)+1); > + struct stat buf; > /* Only do absolute paths: quick and dirty, but should mostly be OK. > Could do relative by tracking cwd. */ > - if (!base || name[0] != '/') > - return name; > + if (!pref || name[0] != '/') > + return name; > + > + strcpy(newname,pref); > + strcat(newname,name); > > - return follow_path(base, name) ?: name; > + return stat(newname,&buf) ? name : strdup(newname); > }
This leaks memory allocated by strdup(). Also, the old code tries to avoid syscalls by memorizing the paths. AFAICS we should do some caching here. Thiemo _______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel