~ubuntu-branches/ubuntu/karmic/gnupg2/karmic-updates

« back to all changes in this revision

Viewing changes to common/signal.c

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 *
7
7
 * GnuPG is free software; you can redistribute it and/or modify
8
8
 * it under the terms of the GNU General Public License as published by
9
 
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * the Free Software Foundation; either version 3 of the License, or
10
10
 * (at your option) any later version.
11
11
 *
12
12
 * GnuPG is distributed in the hope that it will be useful,
15
15
 * GNU General Public License for more details.
16
16
 *
17
17
 * You should have received a copy of the GNU General Public License
18
 
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
18
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20
19
 */
21
20
 
22
21
#include <config.h>
91
90
  const char *s;
92
91
 
93
92
  if (caught_fatal_sig)
94
 
        raise (sig);
 
93
    raise (sig);
95
94
  caught_fatal_sig = 1;
96
 
 
 
95
  
97
96
  if (cleanup_fnc)
98
97
    cleanup_fnc ();
99
98
  /* Better don't translate these messages. */
108
107
  else
109
108
    {
110
109
      /* We are in a signal handler so we can't use any kind of printf
111
 
         even not sprintf.  USe a straightforward algorithm. */
 
110
         even not sprintf.  So we use a straightforward algorithm.  We
 
111
         got a report that on one particular system, raising a signal
 
112
         while in this handler, the parameter SIG get sclobbered and
 
113
         things are messed up because we modify its value.  Although
 
114
         this is a bug in that system, we will protect against it.  */
112
115
      if (sig < 0 || sig >= 100000)
113
116
        write (2, "?", 1);
114
117
      else 
115
118
        {
116
 
          int i, any=0;
 
119
          int i, value, any=0;
117
120
 
118
 
          for (i=10000; i; i /= 10)
 
121
          for (value=sig,i=10000; i; i /= 10)
119
122
            {
120
 
              if (sig >= i || ((any || i==1) && !(sig/i)))
 
123
              if (value >= i || ((any || i==1) && !(value/i)))
121
124
                {
122
 
                  write (2, "0123456789"+(sig/i), 1);
123
 
                  if ((sig/i))
 
125
                  write (2, "0123456789"+(value/i), 1);
 
126
                  if ((value/i))
124
127
                    any = 1;
125
 
                  sig %= i;
 
128
                  value %= i;
126
129
                }
127
130
            }
128
131
        }