The config file parsing has a strict order requirement, because the file is
only scanned through once.  Instead, rewind the file before scanning for each
config variable, so that changing the order doesn't break anything.

Add debug prints of the configuration variables are they are read, to make
testing this easier.

Signed-off-by: Chris Leech <[email protected]>
Tested-by: Ross Brattain <[email protected]>
---

 fcoemon.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fcoemon.c b/fcoemon.c
index f679361..bf0de93 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -243,6 +243,7 @@ static size_t fcm_read_config_variable(char *file, char 
*val_buf, size_t len,
 
        val_buf[0] = '\0';
        buf[sizeof(buf) - 1] = '\0';
+       rewind(fp);
        while ((s = fgets(buf, sizeof(buf) - 1, fp)) != NULL) {
                while (isspace(*s))
                        s++;
@@ -270,6 +271,7 @@ static size_t fcm_read_config_variable(char *file, char 
*val_buf, size_t len,
                        return -1;
                }
                /* found */
+               FCM_LOG_DBG("%s: %s = %s\n", file, var_name, val);
                return 1;
        }
        /* not found */

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to