Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1264039: Read all lines even if file does not end in '\n' or EOL
https://bugzilla.redhat.com/show_bug.cgi?id=1264039

Ensure that all lines of a configuration file are read even if the file does not end in a newline character or EOL.
  • Loading branch information
tiwillia committed Sep 21, 2015
1 parent 1972e43 commit d51d2e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions logshifter/config.go
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bufio"
"io"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -34,7 +35,7 @@ const (
// output types
Syslog = "syslog"
File = "file"
Multi = "multi"
Multi = "multi"

DefaultConfigFile = "/etc/openshift/logshifter.conf"
)
Expand Down Expand Up @@ -62,7 +63,7 @@ func ParseConfig(file string) (*Config, error) {

for {
line, err := reader.ReadString('\n')
if err != nil || len(line) == 0 {
if (err != nil && err != io.EOF) || len(line) == 0 {
break
}

Expand Down

0 comments on commit d51d2e0

Please sign in to comment.