libsofia: handle mid-line comments in resolv.conf patch from Lee Verberne (SFSIP-152)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13749 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris committed 2009-06-10 15:24:34 +00:00
1 parent 3398ddfc82
commit acd67cb318
2 files changed
+4 -4

No files matched your search

@@ -2270,11 +2270,11 @@ int sres_parse_config(sres_config_t *c, FILE *f)
/* Skip whitespace at the beginning ...*/
b = buf + strspn(buf, " \t");
/* ... and at the end of line */
for (len = strlen(b); len > 0 && strchr(" \t\r\n", b[len - 1]); len--)
/* ... and comments + whitespace at the end */
for (len = strcspn(b, "#;"); len > 0 && strchr(" \t\r\n", b[len - 1]); len--)
;
if (len == 0 || b[0] == '#') /* Empty line or comment */
if (len == 0) /* Empty line or comment */
continue;
b[len] = '\0';