Call sd_journal_get_fd() earlier, only if needed
Call sd_journal_get_fd() earlier, only if needed

1. The journald client library initializes inotify watch(es)
during the first call to sd_journal_get_fd(), and it make sense
to open it earlier in order to not lose any journal file rotation
events.

2. It only makes sense to call this if we're going to use it
later on -- so add a check for config.Follow.

3. Remove the redundant call to sd_journal_get_fd().

NOTE that any subsequent calls to sd_journal_get_fd() return
the same file descriptor, so there's no real need to save it
for later use in wait_for_data_cancelable().

Based on earlier patch by Nalin Dahyabhai <nalin@redhat.com>.

Signed-off-by: Kir Kolyshkin <3a017b8ddb3f9cf3e4a59978b004111bdeb97f08@gmail.com>

konstruktoid/docker-upstream,kolyshkin/moby,jameszhan/docker,gnailuy/docker,nalind/docker,Ramzec/docker,flavio/docker,docker/docker,Mokolea/docker,mahak/docker,moul/docker,moby/moby,jimjag/docker,jvanz/docker,AkihiroSuda/docker,jimjag/docker,estesp/docker,kojiromike/docker,AkihiroSuda/docker,paralin/docker,moby/moby,jimjag/docker,nalind/docker,ibuildthecloud/docker,konstruktoid/docker-upstream,bearstech/moby,mahak/docker,tmp6154/docker,dims/docker,paralin/docker,bearstech/moby,vdemeester/docker,kolyshkin/moby,djs55/docker,cpuguy83/docker,mahak/docker,dims/docker,kojiromike/docker,gnailuy/docker,yosifkit/docker,SvenDowideit/docker,Mokolea/docker,SvenDowideit/docker,bearstech/moby,ibuildthecloud/docker,trebonian/docker,justincormack/docker,nawawi/docker,SvenDowideit/docker,jvanz/docker,flavio/docker,justincormack/docker,trebonian/docker,djs55/docker,paralin/docker,ibuildthecloud/docker,flavio/docker,konstruktoid/docker-upstream,estesp/docker,trebonian/docker,yosifkit/docker,moul/docker,vdemeester/docker,bearstech/moby,flavio/docker,yongtang/docker,yongtang/docker,moby/moby,tmp6154/docker,konstruktoid/docker-1,thaJeztah/docker,AkihiroSuda/docker,Mokolea/docker,tmp6154/docker,yosifkit/docker,nawawi/docker,jthelin/docker,konstruktoid/docker-upstream,ibuildthecloud/docker,dims/docker,vdemeester/docker,yosifkit/docker,jvanz/docker,docker/docker,pradipd/moby,thaJeztah/docker,moby/moby,nalind/docker,pradipd/moby,paralin/docker,moul/docker,gnailuy/docker,thaJeztah/docker,jimjag/docker,ibuildthecloud/docker,jthelin/docker,justincormack/docker,docker/docker,trebonian/docker,Ramzec/docker,konstruktoid/docker-1,thaJeztah/docker,cpuguy83/docker,nalind/docker,Ramzec/docker,nawawi/docker,pradipd/moby,AkihiroSuda/docker,jameszhan/docker,cpuguy83/docker,yongtang/docker,cpuguy83/docker,estesp/docker,jameszhan/docker,djs55/docker,kolyshkin/moby,Ramzec/docker,konstruktoid/docker-1,mahak/docker,nawawi/docker,Mokolea/docker,kojiromike/docker,gnailuy/docker,moul/docker