support: Change xgetline to return 0 on EOF
commitcea56af185eae45b1f0963351e3d4daa1cbde521
authorFlorian Weimer <fweimer@redhat.com>
Thu, 2 Apr 2020 15:09:36 +0000 (2 17:09 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 3 Apr 2020 14:26:10 +0000 (3 16:26 +0200)
tree2fca166caab3aaf9ce9f07bb719d0546cff3e4d2
parent17fd707f88c5531972c980a4f4567ba6c7f84067
support: Change xgetline to return 0 on EOF

The advantage is that the buffer will always contain the number
of characters as returned from the function, which allows one to use
a sequence like

  /* No more audit module output.  */
  line_length = xgetline (&buffer, &buffer_length, fp);
  TEST_COMPARE_BLOB ("", 0, buffer, line_length);

to check for an expected EOF, while also reporting any unexpected
extra data encountered.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
support/support_process_state.c
support/xgetline.c
support/xstdio.h