From: Michael R Sweet Date: Fri, 29 Apr 2022 18:02:52 +0000 (-0400) Subject: Update cupsGetResponse to always set the last error when returning NULL. X-Git-Tag: v2.4.2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8456ca2bdde7922310d551633a91a95fd6674230;p=thirdparty%2Fcups.git Update cupsGetResponse to always set the last error when returning NULL. --- diff --git a/CHANGES.md b/CHANGES.md index 0e6331d22c..3f158feffd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ Changes in CUPS v2.4.2 (TBA) IPP Everywhere queue (Issues #340, #343) - Re-added LibreSSL/OpenSSL support (Issue #362) - Updated the Solaris smf service file (Issue #368) +- `cupsGetResponse` did not always set the last error. Changes in CUPS v2.4.1 (27th January 2020) diff --git a/cups/request.c b/cups/request.c index c26749c33d..46ca4e9ccf 100644 --- a/cups/request.c +++ b/cups/request.c @@ -354,7 +354,10 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP DEBUG_puts("2cupsGetResponse: Finishing chunked POST..."); if (httpWrite2(http, "", 0) < 0) + { + _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unable to finish request."), 1); return (NULL); + } } /* @@ -390,6 +393,7 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP * Flush remaining data and delete the response... */ + _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unable to read response."), 1); DEBUG_puts("1cupsGetResponse: IPP read error!"); httpFlush(http); @@ -409,6 +413,8 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP httpFlush(http); + _cupsSetHTTPError(status); + /* * Then handle encryption and authentication... */