chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
48e11fe
)
don't allow comments at the end of lines
author
Lennart Poettering
<lennart@poettering.net>
Wed, 27 Jan 2010 04:30:38 +0000
(
05:30
+0100)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 27 Jan 2010 04:30:38 +0000
(
05:30
+0100)
conf-parser.c
patch
|
blob
|
history
diff --git
a/conf-parser.c
b/conf-parser.c
index 2f013e3f24c26f19a76aa7d1ec7b1d220cfbdf07..0388a24bcc315a5cc556986371ef6a7f5e8cbf23 100644
(file)
--- a/
conf-parser.c
+++ b/
conf-parser.c
@@
-13,6
+13,7
@@
#include "log.h"
#define COMMENTS "#;\n"
#include "log.h"
#define COMMENTS "#;\n"
+#define NEWLINES "\n\r"
#define LINE_MAX 4096
/* Run the user supplied parser for an assignment */
#define LINE_MAX 4096
/* Run the user supplied parser for an assignment */
@@
-77,16
+78,19
@@
static char *strip(char *s) {
/* Parse a variable assignment line */
static int parse_line(const char *filename, unsigned line, char **section, const char* const * sections, const ConfigItem *t, char *l, void *userdata) {
/* Parse a variable assignment line */
static int parse_line(const char *filename, unsigned line, char **section, const char* const * sections, const ConfigItem *t, char *l, void *userdata) {
- char *e, *
c, *b
;
+ char *e, *
b, *c
;
b = l+strspn(l, WHITESPACE);
b = l+strspn(l, WHITESPACE);
- if ((c = strpbrk(b,
COMMENT
S)))
+ if ((c = strpbrk(b,
NEWLINE
S)))
*c = 0;
if (!*b)
return 0;
*c = 0;
if (!*b)
return 0;
+ if (strchr(COMMENTS, *b))
+ return 0;
+
if (startswith(b, ".include ")) {
char *path = NULL, *fn;
int r;
if (startswith(b, ".include ")) {
char *path = NULL, *fn;
int r;