varphone/appweb-3 — comment on commit bffb94f5cfdf1988f91baf7c01be05be995b1f5d
File:  line 0
By varphone:

You are right, it should be "continue" immediately when "enabled == 0", break the parsing loop is too arbitrary.
Thanks for your correction.

diff --git a/src/http/authFile.c b/src/http/authFile.c
index 954da79..2b26f78 100644
--- a/src/http/authFile.c
+++ b/src/http/authFile.c
@@ -533,7 +533,9 @@ int maReadGroupFile(MaServer *server, MaAuth *auth, char *path)

while (mprGets(file, buf, sizeof(buf))) {
enabled = mprStrTok(buf, " :\t", &tok);
-
+ if (!enabled)
+ continue;
+
for (cp = enabled; isspace((int) *cp); cp++) {
;
}
@@ -571,7 +573,9 @@ int maReadUserFile(MaServer *server, MaAuth *auth, char *path)

while (mprGets(file, buf, sizeof(buf))) {
enabled = mprStrTok(buf, " :\t", &tok);
-
+ if (!enabled)
+ continue;
+
for (cp = enabled; isspace((int) *cp); cp++) {

------------------ ԭʼʼ ------------------
: "Embedthis Software";
ʱ: 20111221() 8:30
ռ: "varphone";

: Re: [appweb-3] Fix segment fault occurred in some db files (bffb94f)

But if enabled is null, you don't want to break out of the loop, you want to "continue" and read the next line which may be a valid line.

Why do you want to stop parsing the file if enabled is NULL. Surely, you just want to skip that one line? Or am I missing something else?

---
Reply to this email directly or view it on GitHub:
https://github.com/varphone/appweb-3/commit/bffb94f5cfdf1988f91baf7c01be05be995b1f5d#commitcomment-811147