Skip to content

Commit fadc39b

Browse files
committed
guestagent: Fix isEmptyEvent check
The intention seems to be checking if an event is equal to empty event, ignoring the event time, by copying the event and setting its time to nil. However instead of copying the event, we use the same object and set the event time to nil. I don't know if this caused a user visible problem, but it likely log wrong event time if we log the event. Signed-off-by: Nir Soffer <[email protected]>
1 parent e05d782 commit fadc39b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pkg/guestagent/guestagent_linux.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,8 @@ func (a *agent) collectEvent(ctx context.Context, st eventState) (*api.Event, ev
191191

192192
func isEventEmpty(ev *api.Event) bool {
193193
empty := &api.Event{}
194-
copied := ev
195-
copied.Time = nil
196-
return reflect.DeepEqual(empty, copied)
194+
empty.Time = ev.Time
195+
return reflect.DeepEqual(empty, ev)
197196
}
198197

199198
func (a *agent) Events(ctx context.Context, ch chan *api.Event) {

0 commit comments

Comments
 (0)