diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2010-01-11 14:03:30 +0100 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2010-01-11 14:03:30 +0100 |
commit | 83e056f390c4804f9d283c7083a76dfa957ee054 (patch) | |
tree | 082fd67e0a18ef80f2d47dce760a8e4c99981cf6 | |
parent | 6d63e2e47ac83c5da4362e93009a395d1808e01f (diff) | |
download | pianobar-83e056f390c4804f9d283c7083a76dfa957ee054.tar.gz pianobar-83e056f390c4804f9d283c7083a76dfa957ee054.tar.bz2 pianobar-83e056f390c4804f9d283c7083a76dfa957ee054.zip |
Don't use feof in while loop
-rw-r--r-- | src/settings.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/settings.c b/src/settings.c index 1726a78..d2853e8 100644 --- a/src/settings.c +++ b/src/settings.c @@ -196,10 +196,11 @@ void BarSettingsRead (BarSettings_t *settings) { } /* read config file */ - while (!feof (configfd)) { - memset (val, 0, sizeof (*val)); - memset (key, 0, sizeof (*key)); - if (fscanf (configfd, "%255s = %255[^\n]", key, val) < 2) { + while (1) { + int scanRet = fscanf (configfd, "%255s = %255[^\n]", key, val); + if (scanRet == EOF) { + break; + } else if (scanRet != 2) { /* invalid config line */ continue; } |