[ofa-general] Re: [PATCH 1/3] osm: QoS- bug in opening policy file

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Sun Oct 14 02:00:50 PDT 2007


Sasha Khapyorsky wrote:
> Hi Yevgeny,
> 
> On 11:00 Tue 09 Oct     , Yevgeny Kliteynik wrote:
>> Fixing bug in opening QoS policy file
>>
>> Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
>> ---
>>  opensm/opensm/osm_qos_parser.y |    8 +++++---
>>  1 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/opensm/opensm/osm_qos_parser.y b/opensm/opensm/osm_qos_parser.y
>> index e0faaaf..8e9f282 100644
>> --- a/opensm/opensm/osm_qos_parser.y
>> +++ b/opensm/opensm/osm_qos_parser.y
>> @@ -50,6 +50,7 @@
>>  #include <stdlib.h>
>>  #include <string.h>
>>  #include <ctype.h>
>> +#include <errno.h>
>>  #include <sys/stat.h>
>>  #include <opensm/osm_opensm.h>
>>  #include <opensm/osm_qos_policy.h>
>> @@ -129,6 +130,7 @@ extern char * __qos_parser_text;
>>  extern void __qos_parser_error (char *s);
>>  extern int __qos_parser_lex (void);
>>  extern FILE * __qos_parser_in;
>> +extern int errno;
>>
>>  #define RESET_BUFFER  __parser_tmp_struct_reset()
>>
>> @@ -1750,13 +1752,13 @@ int osm_qos_parse_policy_file(IN osm_subn_t * const p_subn)
>>      osm_qos_policy_destroy(p_subn->p_qos_policy);
>>      p_subn->p_qos_policy = NULL;
>>
>> -    if (!stat(p_subn->opt.qos_policy_file, &statbuf)) {
>> +    if (stat(p_subn->opt.qos_policy_file, &statbuf)) {
> 
> Why this stat() check is needed at all? Right after this there are
> fopen() - all checks could be done according to status there, right?

Good point.

-- Yevgeny

> Sasha
> 
>>          if (strcmp(p_subn->opt.qos_policy_file,OSM_DEFAULT_QOS_POLICY_FILE)) {
>>              osm_log(p_qos_parser_osm_log, OSM_LOG_ERROR,
>>                      "osm_qos_parse_policy_file: ERR AC01: "
>> -                    "QoS policy file not found (%s)\n",
>> -                    p_subn->opt.qos_policy_file);
>> +                    "Failed opening QoS policy file %s - %s\n",
>> +                    p_subn->opt.qos_policy_file, strerror(errno));
>>              res = 1;
>>          }
>>          else
>> -- 
>> 1.5.1.4
>>
>>
> 




More information about the general mailing list