From: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: "linux-rdma
(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH][MINOR] opensm: Support (null) being specified for per_module_logging_file option
Date: Tue, 31 Jul 2012 05:13:37 -0400 [thread overview]
Message-ID: <5017A1C1.4000203@dev.mellanox.co.il> (raw)
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Note that this patch follows previous patch to "Remove unused per_module_logging option"
diff --git a/opensm/osm_console.c b/opensm/osm_console.c
index 0c58a25..b0f7f48 100644
--- a/opensm/osm_console.c
+++ b/opensm/osm_console.c
@@ -341,22 +341,24 @@ static void permodlog_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
FILE *fp;
char buf[1024];
- fp = fopen(p_osm->subn.opt.per_module_logging_file, "r");
- if (!fp) {
- if (errno == ENOENT)
+ if (p_osm->subn.opt.per_module_logging_file != NULL) {
+ fp = fopen(p_osm->subn.opt.per_module_logging_file, "r");
+ if (!fp) {
+ if (errno == ENOENT)
+ return;
+ fprintf(out, "fopen(%s) failed: %s\n",
+ p_osm->subn.opt.per_module_logging_file,
+ strerror(errno));
return;
- fprintf(out, "fopen(%s) failed: %s\n",
- p_osm->subn.opt.per_module_logging_file,
- strerror(errno));
- return;
- }
+ }
- fprintf(out, "Per module logging file: %s\n",
- p_osm->subn.opt.per_module_logging_file);
- while (fgets(buf, sizeof buf, fp) != NULL)
- fprintf(out, "%s", buf);
- fclose(fp);
- fprintf(out, "\n");
+ fprintf(out, "Per module logging file: %s\n",
+ p_osm->subn.opt.per_module_logging_file);
+ while (fgets(buf, sizeof buf, fp) != NULL)
+ fprintf(out, "%s", buf);
+ fclose(fp);
+ fprintf(out, "\n");
+ }
}
static void priority_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
index 3e4e55f..4c69a6f 100644
--- a/opensm/osm_subnet.c
+++ b/opensm/osm_subnet.c
@@ -1522,6 +1522,9 @@ static ib_api_status_t parse_per_mod_logging_file(IN osm_subn_t * p_subn)
osm_reset_log_per_module(log);
+ if (p_subn->opt.per_module_logging_file == NULL)
+ return IB_SUCCESS;
+
fp = fopen(p_subn->opt.per_module_logging_file, "r");
if (!fp) {
if (errno == ENOENT)
@@ -2406,7 +2409,8 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
p_opts->log_file,
p_opts->log_max_size,
p_opts->accum_log_file ? "TRUE" : "FALSE",
- p_opts->per_module_logging_file,
+ p_opts->per_module_logging_file ?
+ p_opts->per_module_logging_file : null_str,
p_opts->dump_files_dir,
p_opts->enable_quirks ? "TRUE" : "FALSE",
p_opts->no_clients_rereg ? "TRUE" : "FALSE",
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2012-07-31 9:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 9:13 Hal Rosenstock [this message]
[not found] ` <5017A1C1.4000203-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-08-01 20:15 ` [PATCH][MINOR] opensm: Support (null) being specified for per_module_logging_file option Alex Netes
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=5017A1C1.4000203@dev.mellanox.co.il \
--to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
--cc=alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).