merge with master
[platform/upstream/cups-filters.git] / packaging / tizen_fix_ignore_sigpipe.patch
1 diff -urN cups-filters.orig/filter/imagetopdf.c cups-filters/filter/imagetopdf.c
2 --- cups-filters.orig/filter/imagetopdf.c       2013-02-05 14:49:33.165014130 +0900
3 +++ cups-filters/filter/imagetopdf.c    2013-02-05 14:51:33.465014116 +0900
4 @@ -40,6 +40,7 @@
5  #include <cupsfilters/image.h>
6  #include <math.h>
7  #include <ctype.h>
8 +#include <signal.h>
9  
10  #if CUPS_VERSION_MAJOR < 1 \
11    || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
12 @@ -712,6 +713,19 @@
13  
14    setbuf(stderr, NULL);
15  
16 +#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
17 +       struct sigaction action;      /*   Actions for POSIX signals */
18 +#endif /*   HAVE_SIGACTION && !HAVE_SIGSET */
19 +       #ifdef HAVE_SIGSET
20 +       sigset(SIGPIPE, SIG_IGN);
21 +#elif defined(HAVE_SIGACTION)
22 +       memset(&action, 0, sizeof(action));
23 +       action.sa_handler = SIG_IGN;
24 +       sigaction(SIGPIPE, &action, NULL);
25 +#else
26 +       signal(SIGPIPE, SIG_IGN);
27 +#endif /*   HAVE_SIGSET */
28 +
29   /*
30    * Check command-line...
31    */
32 diff -urN cups-filters.orig/filter/pdftoijs.cxx cups-filters/filter/pdftoijs.cxx
33 --- cups-filters.orig/filter/pdftoijs.cxx       2013-02-05 14:49:33.161014130 +0900
34 +++ cups-filters/filter/pdftoijs.cxx    2013-02-05 14:52:58.129014106 +0900
35 @@ -30,6 +30,7 @@
36  #include <config.h>
37  #include <stdio.h>
38  #include <stdlib.h>
39 +#include <signal.h>
40  #ifdef HAVE_CPP_POPPLER_VERSION_H
41  #include "cpp/poppler-version.h"
42  #endif
43 @@ -294,6 +295,19 @@
44    globalParams = new GlobalParams();
45    parseOpts(argc, argv);
46  
47 +#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
48 +       struct sigaction action;      /*   Actions for POSIX signals */
49 +#endif /*   HAVE_SIGACTION && !HAVE_SIGSET */
50 +       #ifdef HAVE_SIGSET
51 +       sigset(SIGPIPE, SIG_IGN);
52 +#elif defined(HAVE_SIGACTION)
53 +       memset(&action, 0, sizeof(action));
54 +       action.sa_handler = SIG_IGN;
55 +       sigaction(SIGPIPE, &action, NULL);
56 +#else
57 +       signal(SIGPIPE, SIG_IGN);
58 +#endif /*   HAVE_SIGSET */
59 +
60    if (argc == 6) {
61      /* stdin */
62      int fd;
63 diff -urN cups-filters.orig/filter/texttopdf.c cups-filters/filter/texttopdf.c
64 --- cups-filters.orig/filter/texttopdf.c        2013-02-05 14:49:33.165014130 +0900
65 +++ cups-filters/filter/texttopdf.c     2013-02-05 14:53:47.893014100 +0900
66 @@ -33,6 +33,7 @@
67  #include <assert.h>
68  #include "fontembed/sfnt.h"
69  #include <fontconfig/fontconfig.h>
70 +#include <signal.h>
71  
72  /*
73   * Globals...
74 @@ -157,6 +158,18 @@
75  main(int  argc,                /* I - Number of command-line arguments */
76       char *argv[])     /* I - Command-line arguments */
77  {
78 +#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
79 +           struct sigaction action;      /*    Actions for POSIX signals */
80 +#endif /*    HAVE_SIGACTION && !HAVE_SIGSET */
81 +              #ifdef HAVE_SIGSET
82 +           sigset(SIGPIPE, SIG_IGN);
83 +#elif defined(HAVE_SIGACTION)
84 +           memset(&action, 0, sizeof(action));
85 +           action.sa_handler = SIG_IGN;
86 +           sigaction(SIGPIPE, &action, NULL);
87 +#else
88 +           signal(SIGPIPE, SIG_IGN);
89 +#endif /*    HAVE_SIGSET */
90    return (TextMain("texttopdf", argc, argv));
91  }
92