| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 3/8] tools/xenalyze: Handle fstat errors properly
 George Dunlap writes ("[PATCH 3/8] tools/xenalyze: Handle fstat errors 
properly"):
> They're pretty unlikely to fail, but doesn't hurt to check.
...
> -    fstat(fd, &s);
> +    if ( fstat(fd, &s) ) {
> +        perror("fstat");
> +        free(h);
> +        h = NULL;
> +        goto out;
> +    }
Is there some reason why you're not calling exit ?  mread64 already
does so on mmap failure.
For that matter, is error() not available in this file ?
>          struct stat s;
> -        fstat(G.fd, &s);
> +        if ( fstat(G.fd, &s) ) {
> +            perror("fstat");
> +            error(ERR_SYSTEM, NULL);
> +        }
>          G.file_size = s.st_size;
This hunk LGTM.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |