]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Update cupsGetResponse to always set the last error when returning NULL.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 29 Apr 2022 18:02:52 +0000 (14:02 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 29 Apr 2022 18:02:52 +0000 (14:02 -0400)
CHANGES.md
cups/request.c

index 0e6331d22cc9a6c00f407a4fe620ac4b0a82e75d..3f158feffd2f3f69b585ea74f13bf81e57242dd4 100644 (file)
@@ -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)
index c26749c33d83b502dea18e4b41d4e4607e2aabd8..46ca4e9ccf36d26c32a9780c1002f4cf89bcb6df 100644 (file)
@@ -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...
     */