Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
systemd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
steam
systemd
Commits
d3b6d0c2
Commit
d3b6d0c2
authored
Apr 13, 2013
by
Zbigniew Jędrzejewski-Szmek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fileio: in envfiles, do not skip lines following empty lines
https://bugs.freedesktop.org/show_bug.cgi?id=63477
parent
7914d6bb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
7 deletions
+38
-7
src/binfmt/binfmt.c
src/binfmt/binfmt.c
+1
-1
src/journal/catalog.c
src/journal/catalog.c
+1
-1
src/modules-load/modules-load.c
src/modules-load/modules-load.c
+1
-1
src/shared/conf-parser.c
src/shared/conf-parser.c
+1
-1
src/shared/install.c
src/shared/install.c
+1
-1
src/shared/util.h
src/shared/util.h
+1
-1
src/sysctl/sysctl.c
src/sysctl/sysctl.c
+1
-1
src/test/test-unit-file.c
src/test/test-unit-file.c
+31
-0
No files found.
src/binfmt/binfmt.c
View file @
d3b6d0c2
...
...
@@ -110,7 +110,7 @@ static int apply_file(const char *path, bool ignore_enoent) {
p
=
strstrip
(
l
);
if
(
!*
p
)
continue
;
if
(
strchr
(
COMMENTS
,
*
p
))
if
(
strchr
(
COMMENTS
"
\n
"
,
*
p
))
continue
;
k
=
apply_rule
(
p
);
...
...
src/journal/catalog.c
View file @
d3b6d0c2
...
...
@@ -180,7 +180,7 @@ int catalog_import_file(Hashmap *h, struct strbuf *sb, const char *path) {
continue
;
}
if
(
strchr
(
COMMENTS
,
line
[
0
]))
if
(
strchr
(
COMMENTS
"
\n
"
,
line
[
0
]))
continue
;
if
(
empty_line
&&
...
...
src/modules-load/modules-load.c
View file @
d3b6d0c2
...
...
@@ -206,7 +206,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
l
=
strstrip
(
line
);
if
(
!*
l
)
continue
;
if
(
strchr
(
COMMENTS
,
*
l
))
if
(
strchr
(
COMMENTS
"
\n
"
,
*
l
))
continue
;
k
=
load_module
(
ctx
,
l
);
...
...
src/shared/conf-parser.c
View file @
d3b6d0c2
...
...
@@ -174,7 +174,7 @@ static int parse_line(
if
(
!*
l
)
return
0
;
if
(
strchr
(
COMMENTS
,
*
l
))
if
(
strchr
(
COMMENTS
"
\n
"
,
*
l
))
return
0
;
if
(
startswith
(
l
,
".include "
))
{
...
...
src/shared/install.c
View file @
d3b6d0c2
...
...
@@ -1699,7 +1699,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) {
if
(
!*
l
)
continue
;
if
(
strchr
(
COMMENTS
,
*
l
))
if
(
strchr
(
COMMENTS
"
\n
"
,
*
l
))
continue
;
if
(
first_word
(
l
,
"enable"
))
{
...
...
src/shared/util.h
View file @
d3b6d0c2
...
...
@@ -52,7 +52,7 @@ union dirent_storage {
#define WHITESPACE " \t\n\r"
#define NEWLINE "\n\r"
#define QUOTES "\"\'"
#define COMMENTS "#;
\n
"
#define COMMENTS "#;"
#define FORMAT_BYTES_MAX 8
...
...
src/sysctl/sysctl.c
View file @
d3b6d0c2
...
...
@@ -149,7 +149,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
if
(
!*
p
)
continue
;
if
(
strchr
(
COMMENTS
,
*
p
))
if
(
strchr
(
COMMENTS
"
\n
"
,
*
p
))
continue
;
value
=
strchr
(
p
,
'='
);
...
...
src/test/test-unit-file.c
View file @
d3b6d0c2
...
...
@@ -199,6 +199,17 @@ static void test_config_parse_exec(void) {
"#--nouser-config \\\n" \
"normal=line"
#define env_file_4 \
"# Generated\n" \
"\n" \
"HWMON_MODULES=\"coretemp f71882fg\"\n" \
"\n" \
"# For compatibility reasons\n" \
"\n" \
"MODULE_0=coretemp\n" \
"MODULE_1=f71882fg"
static
void
test_load_env_file_1
(
void
)
{
char
_cleanup_strv_free_
**
data
=
NULL
;
int
r
;
...
...
@@ -251,6 +262,25 @@ static void test_load_env_file_3(void) {
unlink
(
name
);
}
static
void
test_load_env_file_4
(
void
)
{
char
_cleanup_strv_free_
**
data
=
NULL
;
int
r
;
char
name
[]
=
"/tmp/test-load-env-file.XXXXXX"
;
int
_cleanup_close_
fd
=
mkstemp
(
name
);
assert
(
fd
>=
0
);
assert_se
(
write
(
fd
,
env_file_4
,
sizeof
(
env_file_4
))
==
sizeof
(
env_file_4
));
r
=
load_env_file
(
name
,
NULL
,
&
data
);
assert
(
r
==
0
);
assert
(
streq
(
data
[
0
],
"HWMON_MODULES=coretemp f71882fg"
));
assert
(
streq
(
data
[
1
],
"MODULE_0=coretemp"
));
assert
(
streq
(
data
[
2
],
"MODULE_1=f71882fg"
));
assert
(
data
[
3
]
==
NULL
);
unlink
(
name
);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnonnull"
...
...
@@ -327,6 +357,7 @@ int main(int argc, char *argv[]) {
test_load_env_file_1
();
test_load_env_file_2
();
test_load_env_file_3
();
test_load_env_file_4
();
test_install_printf
();
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment