Skip to content

Commit

Permalink
Fix wrong cb parameter in cupsConnectDest() and return NULL pointer…
Browse files Browse the repository at this point in the history
… if connection cannnot be established
  • Loading branch information
jiang-xiaowen-psh committed May 16, 2024
1 parent 09ab94d commit f7015ff
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions cups/dest.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,17 @@ cupsConnectDest(
if (cb)
(*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_CONNECTING, dest);

if (!httpReconnect2(http, msec, cancel) && cb)
if (httpReconnect2(http, msec, cancel))
{
if (cancel && *cancel)
(*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_CONNECTING, dest);
else
(*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_ERROR, dest);
if (cb)
{
if (cancel && *cancel)
(*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_CONNECTING, dest);
else
(*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_ERROR, dest);
}
httpClose(http);
return (NULL);
}
else if (cb)
(*cb)(user_data, CUPS_DEST_FLAGS_NONE, dest);
Expand Down

0 comments on commit f7015ff

Please sign in to comment.