Index: read_config.c
===================================================================
--- read_config.c	(revision 19246)
+++ read_config.c	(working copy)
@@ -697,9 +697,12 @@
  *
  * For each match, check that <when> is the designated time for the
  * <line_handler> function to be executed before processing the line.
+ *
+ * Return 0 if the file is not processed,
+ * Return 1 if it is.
  */
-void
-read_config(const char *filename,
+int
+_read_config(const char *filename,
             struct config_line *line_handler, int when)
 {
     static int      depth = 0;
@@ -733,20 +736,20 @@
 #else                           /* defined(ENOENT) || defined(EACCES) */
             snmp_log_perror(filename);
 #endif                          /* ENOENT */
-        return;
+        return 0;
     }
 
 #define CONFIG_MAX_FILES 4096
     if (files > CONFIG_MAX_FILES) {
         netsnmp_config_error("maximum conf file count (%d) exceeded\n",
                              CONFIG_MAX_FILES);
-        return;
+        return 0;
     }
 #define CONFIG_MAX_RECURSE_DEPTH 16
     if (depth > CONFIG_MAX_RECURSE_DEPTH) {
         netsnmp_config_error("nested include depth > %d\n",
                              CONFIG_MAX_RECURSE_DEPTH);
-        return;
+        return 0;
     }
     ++files;
     ++depth;
@@ -804,13 +807,22 @@
                 ctmp.fileHeader = cptr;
                 ctmp.start = line_handler;
                 ctmp.next = NULL;
-                if ((len > 5) && (strcmp(&cptr[len-5],".conf") == 0))
-                   cptr[len-5] = 0; /* chop off .conf */
                 prev_curfilename = curfilename;
-                read_config_files_of_type(when,&ctmp);
+                /*
+                 * Try reading the specified file directly first.
+                 */
+                if ( !_read_config(cptr, line_handler, when)) {
+                    /*
+                     * If that doesn't work,
+                     * then search the config path for suitably named file(s)
+                     */
+                    if ((len > 5) && (strcmp(&cptr[len-5],".conf") == 0))
+                        cptr[len-5] = 0; /* chop off .conf */
+                    read_config_files_of_type(when,&ctmp);
+                    if ((len > 5) && (cptr[len-5] == 0))
+                        cptr[len-5] = '.'; /* restore .conf */
+                }
                 curfilename = prev_curfilename;
-                if ((len > 5) && (cptr[len-5] == 0))
-                   cptr[len-5] = '.'; /* restore .conf */
                 continue;
             } else {
                 lptr = line_handler;
@@ -826,12 +838,19 @@
     }
     fclose(ifile);
     --depth;
-    return;
+    return 1;
 
 }                               /* end read_config() */
 
+void
+read_config(const char *filename,
+            struct config_line *line_handler, int when)
+{
+    _read_config(filename, line_handler, when);
+}
 
 
+
 void
 free_config(void)
 {
