Clean up a deferred function call in the journal reading logic.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
(cherry picked from commit 1ada3e85bf89201910c28f2ff6892c00cee0f137)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
| ... | ... |
@@ -330,12 +330,12 @@ func (s *journald) readLogs(logWatcher *logger.LogWatcher, config logger.ReadCon |
| 330 | 330 |
// here, potentially while the goroutine that uses them is still |
| 331 | 331 |
// running. Otherwise, close them when we return from this function. |
| 332 | 332 |
following := false |
| 333 |
- defer func(pfollowing *bool) {
|
|
| 334 |
- if !*pfollowing {
|
|
| 333 |
+ defer func() {
|
|
| 334 |
+ if !following {
|
|
| 335 | 335 |
close(logWatcher.Msg) |
| 336 | 336 |
} |
| 337 | 337 |
C.sd_journal_close(j) |
| 338 |
- }(&following) |
|
| 338 |
+ }() |
|
| 339 | 339 |
// Remove limits on the size of data items that we'll retrieve. |
| 340 | 340 |
rc = C.sd_journal_set_data_threshold(j, C.size_t(0)) |
| 341 | 341 |
if rc != 0 {
|