public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Khapyorsky <sashak@voltaire.com>
To: "Stan C. Smith" <stan.smith@intel.com>
Cc: ofw@lists.openfabrics.org, 'linux-rdma' <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH] remove unnecessary leading '/' from filename
Date: Mon, 12 Oct 2009 23:54:55 +0200	[thread overview]
Message-ID: <20091012215455.GK13830@me> (raw)
In-Reply-To: <784A3771E5D143179461A7D5151AE78C@amr.corp.intel.com>

On 16:46 Wed 07 Oct     , Stan C. Smith wrote:
> 
> In osm_db_domain_init() the filename is appended to a path string 'db_dir_name' which contains a trailing '/'.
> Remove extra '/'.
> 
> Signed-off-by: stan smith <stan.smith@intel.com>
> 
> diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
> index 947fe7a..1704054 100644
> --- a/opensm/opensm/osm_lid_mgr.c
> +++ b/opensm/opensm/osm_lid_mgr.c
> @@ -239,7 +239,7 @@ ib_api_status_t osm_lid_mgr_init(IN osm_lid_mgr_t * p_mgr, IN osm_sm_t * sm)
>  	p_mgr->p_lock = sm->p_lock;
>  
>  	/* we initialize and restore the db domain of guid to lid map */
> -	p_mgr->p_g2l = osm_db_domain_init(p_mgr->p_db, "/guid2lid");
> +	p_mgr->p_g2l = osm_db_domain_init(p_mgr->p_db, "guid2lid");

I think that this can break when OSM_CACHE_DIR is supplied as
environment variable and its value doesn't have '/' at the end. The
patch below is from 2007 and it fixed this issue.

Sasha


commit 907b95ec02d6a794ee8f6d6996cc6350a476bd15
Author: Albert L. Chu <chu11@llnl.gov>
Date:   Wed Mar 14 07:08:58 2007 -0500

    OpenSM: Fix cache filename corner case
    
    Signed-off-by: Albert L. Chu <chu11@llnl.gov>
    Signed-off-by: Hal Rosenstock <halr@voltaire.com>

diff --git a/osm/opensm/osm_lid_mgr.c b/osm/opensm/osm_lid_mgr.c
index 89adc48..bd5945f 100644
--- a/osm/opensm/osm_lid_mgr.c
+++ b/osm/opensm/osm_lid_mgr.c
@@ -282,7 +282,7 @@ osm_lid_mgr_init(
   p_mgr->p_req = p_req;
 
   /* we initialize and restore the db domain of guid to lid map */
-  p_mgr->p_g2l = osm_db_domain_init(p_mgr->p_db, "guid2lid");
+  p_mgr->p_g2l = osm_db_domain_init(p_mgr->p_db, "/guid2lid");
   if (! p_mgr->p_g2l)
   {
     osm_log( p_mgr->p_log, OSM_LOG_ERROR,
diff --git a/osm/opensm/osm_subnet.c b/osm/opensm/osm_subnet.c
index 99e39aa..cbb3549 100644
--- a/osm/opensm/osm_subnet.c
+++ b/osm/opensm/osm_subnet.c
@@ -745,7 +745,7 @@ osm_subn_rescan_conf_file(
     p_cache_dir = OSM_DEFAULT_CACHE_DIR;
 
   strcpy(file_name, p_cache_dir);
-  strcat(file_name, "opensm.opts");
+  strcat(file_name, "/opensm.opts");
   
   opts_file = fopen(file_name, "r");
   if (!opts_file)
@@ -838,7 +838,7 @@ osm_subn_parse_conf_file(
     p_cache_dir = OSM_DEFAULT_CACHE_DIR;
 
   strcpy(file_name, p_cache_dir);
-  strcat(file_name, "opensm.opts");
+  strcat(file_name, "/opensm.opts");
   
   opts_file = fopen(file_name, "r");
   if (!opts_file) return;
@@ -1096,7 +1096,7 @@ osm_subn_write_conf_file(
     p_cache_dir = OSM_DEFAULT_CACHE_DIR;
 
   strcpy(file_name, p_cache_dir);
-  strcat(file_name, "opensm.opts");
+  strcat(file_name, "/opensm.opts");
   
   opts_file = fopen(file_name, "w");
   if (!opts_file) return;

>  	if (!p_mgr->p_g2l) {
>  		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0316: "
>  			"Error initializing Guid-to-Lid persistent database\n");
> 

  reply	other threads:[~2009-10-12 21:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07 23:46 [PATCH] remove unnecessary leading '/' from filename Stan C. Smith
2009-10-12 21:54 ` Sasha Khapyorsky [this message]
2009-10-12 22:18   ` Smith, Stan
     [not found]     ` <3F6F638B8D880340AB536D29CD4C1E1912C896BBDA-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2009-11-28 14:23       ` Sasha Khapyorsky
2009-11-28 14:26         ` [PATCH] opensm/osm_db_files.c: add '/' path delimited Sasha Khapyorsky
2009-11-28 14:27           ` [PATCH] opensm/osm_base.h: remove trailing '/' in OSM_DEFAULT_CACHE_DIR Sasha Khapyorsky
2009-11-28 16:35           ` [PATCH] opensm/osm_db_files.c: add '/' path delimited Smith, Stan
     [not found]             ` <3F6F638B8D880340AB536D29CD4C1E1912CC7DAF13-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2009-11-28 17:36               ` Bart Van Assche
     [not found]                 ` <e2e108260911280936w27de9761r7a8818184f184535-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-11-28 20:16                   ` Smith, Stan
2009-11-28 16:30         ` [PATCH] remove unnecessary leading '/' from filename Smith, Stan
     [not found]           ` <3F6F638B8D880340AB536D29CD4C1E1912CC7DAF12-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2009-11-29 12:49             ` Sasha Khapyorsky
     [not found] ` <784A3771E5D143179461A7D5151AE78C-Zpru7NauK7drdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2009-11-28 14:28   ` Sasha Khapyorsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091012215455.GK13830@me \
    --to=sashak@voltaire.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=ofw@lists.openfabrics.org \
    --cc=stan.smith@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox