affile: fixed a pipe permission problem

When syslog-ng creates a pipe, create it with user-specified permissions
or restrictive ones (0600) by default, instead of creating it with broad
read-write permissions (0666) and patching it up later.

Signed-off-by: Budai Laszlo <lbudai@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
affile: affile_open_file() refactoring

This splits up the large affile_open_file() function into smaller, more
readable private functions, that makes it easier to understand the
control flow.

Signed-off-by: Budai Laszlo <lbudai@balabit.hu>