~ubuntu-branches/ubuntu/jaunty/cups/jaunty

« back to all changes in this revision

Viewing changes to cups/http-addr.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt, Till Kamppeter, Martin Pitt
  • Date: 2009-02-15 18:39:03 UTC
  • mfrom: (6.1.30 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090215183903-i0nhvqyqj4vyn52a
Tags: 1.3.9-13
[ Till Kamppeter ]
* debian/local/filters/pdf-filters/filter/imagetopdf.c: Added support for
  the new "fit-to-page" option (new, more intuitive name for "fitplot").
* debian/filters/pstopdf: Only apply paper size if the "fitplot" or the
  "fit-to-page" option is set.
* debian/local/filters/cpdftocps: Only the last digit of the number of
  copies was used (LP: #309314).
* debian/local/filters/pdf-filters/pdftopdf/pdftopdf.cxx: Do not preceed the
  PDF output with a newline (LP: #303691). Only impose the page size from
  the PPD file to all pages if the "fitplot" or the "fit-to-page" option is 
  set. This prevented from automatic paper tray switching to the correct paper
  sizes when a multiple-page-size document is printed (partial fix for
  LP: #310575).
* debian/patches/pdftops-cups-1.4.dpatch: Updated from CUPS 1.4 SVN. Contains
  fixes for multiple-page-size document printing (partial fix for
  LP: #310575).
* debian/patches/pdftops-dont_fail_on_cancel.dpatch: Removed, should be
  fixed in the new upstream version of pdftops.

[ Martin Pitt ]
* debian/patches/pdftops-cups-1.4.dpatch: Add definition of
  HAVE_PDFTOPS and CUPS_PDFTOPS, so that the filter actually gets
  again built with pdftops support. (Fixes Till's change from above).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * "$Id: http-addr.c 7721 2008-07-11 22:48:49Z mike $"
 
2
 * "$Id: http-addr.c 7911 2008-09-06 00:30:39Z mike $"
3
3
 *
4
4
 *   HTTP address routines for the Common UNIX Printing System (CUPS).
5
5
 *
28
28
 * Include necessary headers...
29
29
 */
30
30
 
 
31
#include "http-private.h"
31
32
#include "globals.h"
32
33
#include "debug.h"
33
34
#include <stdlib.h>
34
35
#include <stddef.h>
 
36
#ifdef HAVE_RESOLV_H
 
37
#  include <resolv.h>
 
38
#endif /* HAVE_RESOLV_H */
35
39
 
36
40
 
37
41
/*
175
179
    char              *name,            /* I - Host name buffer */
176
180
    int               namelen)          /* I - Size of name buffer */
177
181
{
 
182
  _cups_globals_t       *cg = _cupsGlobals();
 
183
                                        /* Global data */
 
184
 
 
185
 
178
186
  DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)\n",
179
187
                addr, name, namelen));
180
188
 
192
200
 
193
201
#ifdef AF_LOCAL
194
202
  if (addr->addr.sa_family == AF_LOCAL)
 
203
  {
195
204
    strlcpy(name, addr->un.sun_path, namelen);
196
 
  else
 
205
    return (name);
 
206
  }
197
207
#endif /* AF_LOCAL */
 
208
 
 
209
#ifdef HAVE_RES_INIT
 
210
 /*
 
211
  * STR #2920: Initialize resolver after failure in cups-polld
 
212
  *
 
213
  * If the previous lookup failed, re-initialize the resolver to prevent
 
214
  * temporary network errors from persisting.  This *should* be handled by
 
215
  * the resolver libraries, but apparently the glibc folks do not agree.
 
216
  *
 
217
  * We set a flag at the end of this function if we encounter an error that
 
218
  * requires reinitialization of the resolver functions.  We then call
 
219
  * res_init() if the flag is set on the next call here or in httpAddrLookup().
 
220
  */
 
221
 
 
222
  if (cg->need_res_init)
 
223
  {
 
224
    res_init();
 
225
 
 
226
    cg->need_res_init = 0;
 
227
  }
 
228
#endif /* HAVE_RES_INIT */
 
229
 
198
230
#ifdef HAVE_GETNAMEINFO
199
231
  {
200
232
   /*
205
237
    * do...
206
238
    */
207
239
 
208
 
    if (getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen,
209
 
                    NULL, 0, 0))
 
240
    int error = getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen,
 
241
                            NULL, 0, 0);
 
242
 
 
243
    if (error)
 
244
    {
 
245
      if (error == EAI_FAIL)
 
246
        cg->need_res_init = 1;
 
247
 
210
248
      return (httpAddrString(addr, name, namelen));
 
249
    }
211
250
  }
212
251
#else
213
252
  {
229
268
      * No hostname, so return the raw address...
230
269
      */
231
270
 
232
 
      httpAddrString(addr, name, namelen);
233
 
      return (NULL);
 
271
      if (h_errno == NO_RECOVERY)
 
272
        cg->need_res_init = 1;
 
273
 
 
274
      return (httpAddrString(addr, name, namelen));
234
275
    }
235
276
 
236
277
    strlcpy(name, host->h_name, namelen);
552
593
 
553
594
 
554
595
/*
555
 
 * End of "$Id: http-addr.c 7721 2008-07-11 22:48:49Z mike $".
 
596
 * End of "$Id: http-addr.c 7911 2008-09-06 00:30:39Z mike $".
556
597
 */