[ofa-general] Re: [PATCH] osm: TRIVIAL bug fix

Hal Rosenstock halr at voltaire.com
Mon Jun 11 07:39:19 PDT 2007


Hi Yevgeny,

On Mon, 2007-06-11 at 10:21, Yevgeny Kliteynik wrote:
> Hi Hal,
> 
> Fixing a small bug that was "inherited" when moved code that 
> reads guid file from osm_ucast_updn.c to osm_ucast_mgr.c - 
> closing file descriptor when finished reading the guid file.
> 
> -- Yevgeny
> 
> Signed-off-by:  Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
> ---
>  opensm/opensm/osm_ucast_mgr.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
> index b080f59..d855683 100644
> --- a/opensm/opensm/osm_ucast_mgr.c
> +++ b/opensm/opensm/osm_ucast_mgr.c
> @@ -1052,7 +1052,7 @@ osm_ucast_mgr_read_guid_file(
>    IN  cl_list_t       * p_list )
>  {
>    cl_status_t   status = IB_SUCCESS;
> -  FILE        * guid_file;
> +  FILE        * guid_file = NULL;

Is this really needed ? Doesn't fopen return NULL on error ?

-- Hal

>    char          line[MAX_GUID_FILE_LINE_LENGTH];
>    char        * endptr;
>    uint64_t    * p_guid;
> @@ -1112,6 +1112,8 @@ osm_ucast_mgr_read_guid_file(
>    }
>  
>  Exit :
> +  if (guid_file)
> +    fclose(guid_file);
>    OSM_LOG_EXIT( p_mgr->p_log );
>    return (status);
>  }




More information about the general mailing list