[ofa-general] Re: Error message in OSM log when cached op file doesn't exist
Sasha Khapyorsky
sashak at voltaire.com
Mon May 14 14:05:41 PDT 2007
Hi Yevgeny,
On 17:07 Mon 14 May , Yevgeny Kliteynik wrote:
>
> I actually don't like this thing, because now every time you run
> OpenSM on the machine that doesn't have any cached options file
> (which is usually the case) you get an error message.
>
> There's no point checking whether the file exists, because osm runs
> as root,
Not necessary.
> and if it fails opening this file, it means that the file
> doesn't exist or is inaccessible (broken mount, etc).
or user provided OSM_CACHE_DIR environment variable is broken or malloc
failed, or other error (see: man 3 fopen, man 2 open, man 3 malloc)
Probably just this solves your issue:
diff --git a/osm/opensm/osm_subnet.c b/osm/opensm/osm_subnet.c
index 855d1ab..f7ddf7d 100644
--- a/osm/opensm/osm_subnet.c
+++ b/osm/opensm/osm_subnet.c
@@ -51,6 +51,7 @@
#include <string.h>
#include <stdio.h>
+#include <errno.h>
#include <limits.h>
#include <complib/cl_debug.h>
#include <complib/cl_log.h>
@@ -856,7 +857,7 @@ osm_subn_parse_conf_file(
opts_file = fopen(file_name, "r");
if (!opts_file)
- return IB_ERROR;
+ return errno == ENOENT ? IB_SUCCESS : IB_ERROR;
while (fgets(line, 1023, opts_file) != NULL)
{
Or yet another IB_* status value and less aggressive warning message?
Sasha
More information about the general
mailing list