Imported Debian patch 2.0.1+dfsg-1
[packages/binwalk.git] / debian / patches / 0003-fix-return-exit-value-shared-libs-cannot-use-exit-bu.patch
1 From c37f8e9081407225d84bfb2215250823898de810 Mon Sep 17 00:00:00 2001
2 From: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
3 Date: Mon, 25 Aug 2014 11:17:12 +0200
4 Subject: [PATCH] fix return exit value, shared libs cannot use exit, but
5  return instead
6
7 ---
8  src/C/compress/compress42.c | 30 +++++++++++++++---------------
9  1 file changed, 15 insertions(+), 15 deletions(-)
10
11 --- a/src/C/compress/compress42.c
12 +++ b/src/C/compress/compress42.c
13 @@ -193,7 +193,6 @@
14         extern  void    *memset LARGS((void *,char,unsigned int));
15         extern  void    *memcpy LARGS((void *,void const *,unsigned int));
16         extern  int             atoi    LARGS((char const *));
17 -       extern  void    exit    LARGS((int));
18         extern  int             isatty  LARGS((int));
19  #endif
20         
21 @@ -645,7 +644,7 @@
22  #endif
23  
24  int    main                    ARGS((int,char **));
25 -void   Usage                   ARGS((void));
26 +int    Usage                   ARGS((void));
27  void   comprexx                ARGS((char **));
28  void   compdir                 ARGS((char *));
29  void   compress                ARGS((int,int));
30 @@ -654,9 +653,9 @@
31  int    is_compressed           ARGS((char *,int));
32  void   read_error              ARGS((void));
33  void   write_error             ARGS((void));
34 -void   abort_compress  ARGS((void));
35 +int    abort_compress  ARGS((void));
36  void   prratio                 ARGS((FILE *,long,long));
37 -void   about                   ARGS((void));
38 +int    about                   ARGS((void));
39  
40  /*****************************************************************
41   * TAG( main )
42 @@ -724,7 +723,7 @@
43         if (filelist == NULL)
44                 {
45                         fprintf(stderr, "Cannot allocate memory for file list.\n");
46 -                       exit (1);
47 +                       return 1;
48                 }
49         fileptr = filelist;
50         *filelist = NULL;
51 @@ -765,9 +764,8 @@
52                                         {
53                                 case 'V':
54                                                 about();
55 -                                               break;
56 -
57 -                                       case 's':
58 +                                               return 0;
59 +                               case 's':
60                                                 silent = 1;
61                                                 quiet = 1;
62                                                 break;
63 @@ -799,6 +797,7 @@
64                                                 {
65                                                 fprintf(stderr, "Missing maxbits\n");
66                                                 Usage();
67 +                                               return 1;
68                                                 }
69  
70                                                 maxbits = atoi(*argv);
71 @@ -823,6 +822,7 @@
72                                 default:
73                                                 fprintf(stderr, "Unknown flag: '%c'; ", **argv);
74                                                 Usage();
75 +                                               return 1;
76                                         }
77                         }
78                         }
79 @@ -873,10 +873,10 @@
80                 //rsize = read(0, input_buffer, sizeof(input_buffer));
81                 //decompress(input_buffer, rsize);
82  
83 -               //exit((exit_code== -1) ? 1:exit_code);
84 +               //return (exit_code== -1) ? 1:exit_code;
85         }
86  
87 -void
88 +int
89  Usage()
90         {
91                 fprintf(stderr, "\
92 @@ -894,7 +894,7 @@
93         -r   Recursive. If a filename is a directory, descend\n\
94              into it and compress everything in it.\n");
95  
96 -               exit(1);
97 +               return 1;
98         }
99  
100  void
101 @@ -1888,13 +1888,13 @@
102                 abort_compress();
103         }
104  
105 -void
106 +int
107  abort_compress()
108         {
109                 if (remove_ofname)
110                 unlink(ofname);
111  
112 -               exit(1);
113 +               return 1;
114         }
115  
116  void
117 @@ -1924,7 +1924,7 @@
118                 fprintf(stream, "%d.%02d%%", q / 100, q % 100);
119         }
120  
121 -void
122 +int
123  about()
124         {
125                 /* CJH */
126 @@ -1977,5 +1977,5 @@
127       Spencer W. Thomas, Jim McKie, Steve Davies,\n\
128       Ken Turkowski, James A. Woods, Joe Orost\n");
129  
130 -               exit(0);
131 +               return 0;
132         }