[CRIU] [PATCH] proc_parse: parse_smaps -- Use @file_path instead of strstr helper

Cyrill Gorcunov gorcunov at gmail.com
Fri Oct 10 07:14:55 PDT 2014


On Fri, Oct 10, 2014 at 06:08:27PM +0400, Pavel Emelyanov wrote:
> On 10/10/2014 03:36 PM, Cyrill Gorcunov wrote:
> > strstr is a really heavy one, lets use already defined
> > and filled @file_path variable instead.
> > 
> > Reported-by: Pavel Emelyanov <xemul at parallels.com>
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  proc_parse.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/proc_parse.c b/proc_parse.c
> > index 98fef4add2e2..09a368fdacf4 100644
> > --- a/proc_parse.c
> > +++ b/proc_parse.c
> > @@ -420,9 +420,10 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, bool use_map_file
> >  
> >  		if (vma_area->e->status != 0) {
> >  			continue;
> > -		} else if (strstr(str, "[vsyscall]") || strstr(str, "[vectors]")) {
> > +		} else if (!strcmp(file_path, "[vsyscall]") ||
> > +			   !strcmp(file_path, "[vectors]")) {
> 
> Have you tested it? The file_path is 5-bytes length.

Heh, true. I've tested it but seems we're pretty fine even with this nit,
nothing failed. I'll fix, thanks.


More information about the CRIU mailing list