projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
98bf501
)
sysctl: no need to check for eof twice
author
Lennart Poettering
<lennart@poettering.net>
Tue, 25 Oct 2016 07:26:31 +0000
(09:26 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 2 Nov 2016 17:29:59 +0000
(11:29 -0600)
Let's only check for eof once after the fgets(). There's no point in checking
EOF before the first read, and twice in each loop.
src/sysctl/sysctl.c
patch
|
blob
|
history
diff --git
a/src/sysctl/sysctl.c
b/src/sysctl/sysctl.c
index
7117955
..
cce91b3
100644
(file)
--- a/
src/sysctl/sysctl.c
+++ b/
src/sysctl/sysctl.c
@@
-104,7
+104,7
@@
static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign
}
log_debug("Parsing %s", path);
-
while (!feof(f)
) {
+
for (;;
) {
char l[LINE_MAX], *p, *value, *new_value, *property, *existing;
void *v;
int k;