[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] [REPOST] Simplily linux-user/path.c
From: |
Kirill A. Shutemov |
Subject: |
Re: [Qemu-devel] [PATCH] [REPOST] Simplily linux-user/path.c |
Date: |
Tue, 20 Mar 2007 16:41:12 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On [Fri, 23.02.2007 16:58], Thiemo Seufer wrote:
> 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.
Rewritten patch with caching in the attachment. Please, review.
--
Regards, Kirill A. Shutemov
+ Belarus, Minsk
+ Velesys LLC, http://www.velesys.com/
+ ALT Linux Team, http://www.altlinux.com/
qemu-0.9.0-alt-path.patch
Description: Text document
signature.asc
Description: Digital signature
- Re: [Qemu-devel] [PATCH] [REPOST] Simplily linux-user/path.c,
Kirill A. Shutemov <=