Re: No hrSWRunPath in HOST-RESOURCES-MIB

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
2009/3/29 Thomas Anders <[email protected]>:
> I could reproduce the problem on openSuSE 11.1 with *all* of the following:
> - SuSE-provided net-snmp RPM
> - stock net-snmp 5.4.2.1 (built from source)
> - net-snmp SVN trunk (built from source)

That's very useful, Thomas - thanks.

I'm pretty sure the problem lies somewhere in the block of code
   mibgroup/host/hr_swrun.c:745-764  (in the current trunk)
But it's not entirely clear exactly where.

Thomas,
    could you possibly try the attached (temporary) patch,
and let me know whether it makes any difference.
(and if so, what you see)

Thanks

Dave

------------------------------------------------------------------------------

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
hr_swrun.patch (text/x-diff, 1.2 KB)
--- hr_swrun.c.cln	2009-03-30 09:32:33.815852000 +0100
+++ hr_swrun.c	2009-03-30 09:53:23.206391000 +0100
@@ -750,18 +750,17 @@
              */
             fclose(fp);
             sprintf(string, "/proc/%d/status", pid);
-            if ((fp = fopen(string, "r")) == NULL)
-                return NULL;
+            if ((fp = fopen(string, "r")) == NULL) {
+                strcpy(string, "<no status>");
+            } else {
             fgets(buf, sizeof(buf), fp);        /* Name: process name */
             if ( cp == NULL ) {
-                fclose(fp);
-                return NULL;    /* the process probably died */
-            }
+                strcpy(string, "<empty status>");
+            } else {
             cp = strchr(buf, ':');
             if ( cp == NULL ) {
-                fclose(fp);
-                return NULL;    /* the process file is malformed */
-            }
+                strcpy(string, "<malformed status>");
+            } else {
             ++cp;
             while (isspace(*cp))
                 ++cp;
@@ -769,6 +768,7 @@
             cp = strchr(string, '\n');
             if (cp)
                 *cp = 0;
+            }}}
         }
         fclose(fp);
 #elif defined(cygwin)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.