Skip to content

Commit

Permalink
Add meaningful error messages to IPP Everywhere PPD generator (Issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Mar 9, 2017
1 parent 3ae6282 commit a946858
Show file tree
Hide file tree
Showing 13 changed files with 474 additions and 392 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ CHANGES IN CUPS V2.2.3
supported by the printer (Issue #4953)
- IPP Everywhere print queues did not always support all media types
supported by the printer (Issue #4953)
- The IPP Everywhere PPD generator did not return useful error messages
(Issue #4954)
- Fixed some localization issues on macOS (<rdar://problem/27245567>)


Expand Down
16 changes: 15 additions & 1 deletion cups/ppd-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -3147,15 +3147,27 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
if (buffer)
*buffer = '\0';

if (!buffer || bufsize < 1 || !response)
if (!buffer || bufsize < 1)
{
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (NULL);
}

if (!response)
{
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No IPP attributes."), 1);
return (NULL);
}

/*
* Open a temporary file for the PPD...
*/

if ((fp = cupsTempFile2(buffer, (int)bufsize)) == NULL)
{
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
return (NULL);
}

/*
* Standard stuff for PPD file...
Expand Down Expand Up @@ -4081,6 +4093,8 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
unlink(buffer);
*buffer = '\0';

_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Printer does not support required IPP attributes or document formats."), 1);

return (NULL);
}

Expand Down
Loading

0 comments on commit a946858

Please sign in to comment.