Hi Sami, Andreas, On Mon, Jul 06, 2015 at 09:29:44AM +0200, Andreas Henriksson wrote: > Robie Basak, could you please try if Samis patch resolves the issue > you where experiencing? See attachement.
Thank you for working on this. I get an error with this patch: "logger: close failed: Bad file descriptor" and a subsequent non-zero exit status which then causes the postinst to fail. Looking at the code, I think the reason is that ctl->fd ends up with a file descriptor that failed to connect and thus has been closed, and then logger_close() tries to close it again. I fixed up the patch by expicitly returning an fd of -1 on logger_open() failure (as well as setting ctl->noact to 1) so that ctl->fd ends up being -1, and then checking for -1 in logger_close(). This now works. I reproduced the original failure and have observed that it is solved with my amended patch. piuparts succeeds past the stage that logger was causing it to fail before when I use my locally built deb of the patched util-linux source. Please review my amendments and apply. Thanks, Robie
--- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -242,9 +242,10 @@ static int unix_socket(struct logger_ctl if (ctl->unix_socket_errors) err(EXIT_FAILURE, _("socket %s"), path); else - /* See --socket-errors manual page entry for - * explanation of this strange exit. */ - exit(EXIT_SUCCESS); + /* openlog(3) compatibility, socket errors are + * not reported, but ignored silently */ + ctl->noact = 1; + return -1; } return fd; } @@ -685,7 +686,7 @@ static void logger_stdin(struct logger_c static void logger_close(const struct logger_ctl *ctl) { - if (close(ctl->fd) != 0) + if (ctl->fd != -1 && close(ctl->fd) != 0) err(EXIT_FAILURE, _("close failed")); free(ctl->hdr); }
signature.asc
Description: Digital signature