summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-04-17 11:02:56 +0200
committerHarald Hoyer <harald@redhat.com>2013-04-17 11:06:25 +0200
commitdb5372091664c977a937f6bc0fe4484363be0669 (patch)
tree4bb3289db0f58e2ca3d48b4088b4bd8ae616840f /src/shared
parent03bb799e0b3560dca8c9b70de3dbadb0c281b36f (diff)
fileio:parse_env_file_internal() fix environment file parsing
parse_env_file_internal() could not parse the following lines correctly: export key="val" key="val"#comment
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/fileio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 617afeace2..3f242edc60 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -209,7 +209,9 @@ static int parse_env_file_internal(
switch (state) {
case PRE_KEY:
- if (strchr(COMMENTS, c))
+ if (startswith(p, "export "))
+ p+=6;
+ else if (strchr(COMMENTS, c))
state = COMMENT;
else if (!strchr(WHITESPACE, c)) {
state = KEY;
@@ -255,7 +257,7 @@ static int parse_env_file_internal(
break;
case PRE_VALUE:
- if (strchr(newline, c)) {
+ if (strchr(newline, c) || strchr(COMMENTS, c)) {
state = PRE_KEY;
key[n_key] = 0;