From patchwork Thu Apr 8 13:14:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Kliteynik X-Patchwork-Id: 91267 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o38DEbtZ005167 for ; Thu, 8 Apr 2010 13:14:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758722Ab0DHNOg (ORCPT ); Thu, 8 Apr 2010 09:14:36 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:42023 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758712Ab0DHNOf (ORCPT ); Thu, 8 Apr 2010 09:14:35 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from kliteyn@dev.mellanox.co.il) with SMTP; 8 Apr 2010 16:14:29 +0300 Received: from [10.4.1.29] ([10.4.1.29]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 8 Apr 2010 16:14:29 +0300 Message-ID: <4BBDD6AA.5050504@dev.mellanox.co.il> Date: Thu, 08 Apr 2010 16:14:18 +0300 From: Yevgeny Kliteynik User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Sasha Khapyorsky CC: Linux RDMA Subject: [PATCH] opensm/osm_sa.c: enhance opensm_dump_to_file() to accept full path file name X-OriginalArrivalTime: 08 Apr 2010 13:14:29.0108 (UTC) FILETIME=[6B806340:01CAD71D] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-6.000.1038-17306.007 X-TM-AS-Result: No--1.435000-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 08 Apr 2010 13:14:39 +0000 (UTC) diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c index 3473e4c..8aab548 100644 --- a/opensm/opensm/osm_sa.c +++ b/opensm/opensm/osm_sa.c @@ -510,8 +510,13 @@ opensm_dump_to_file(osm_opensm_t * p_osm, const char *file_name, char path[1024]; FILE *file; - snprintf(path, sizeof(path), "%s/%s", - p_osm->subn.opt.dump_files_dir, file_name); + if (*file_name == '/') + /* file name was provided as an absolute path */ + snprintf(path, sizeof(path), "%s", file_name); + else + /* file name is relative to dump_files_dir */ + snprintf(path, sizeof(path), "%s/%s", + p_osm->subn.opt.dump_files_dir, file_name); file = fopen(path, "w"); if (!file) {