~ubuntu-branches/ubuntu/precise/gzip/precise

« back to all changes in this revision

Viewing changes to lib/pipe-safer.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-10-19 11:42:42 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20111019114242-d8wiiu8kbvdtgmgj
Tags: 1.4-1ubuntu1
* Merge with Debian testing.  Remaining Ubuntu changes:
  - debian/{control,rules}: Remove the Win32 build and mingw64
    build-dependency, since mingw is in universe, and will remain so for
    the forseeable future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Invoke pipe, but avoid some glitches.
2
 
   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 
2
   Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
3
3
 
4
 
   This program is free software; you can redistribute it and/or modify
 
4
   This program is free software: you can redistribute it and/or modify
5
5
   it under the terms of the GNU General Public License as published by
6
 
   the Free Software Foundation; either version 2, or (at your option)
7
 
   any later version.
 
6
   the Free Software Foundation; either version 3 of the License, or
 
7
   (at your option) any later version.
8
8
 
9
9
   This program is distributed in the hope that it will be useful,
10
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
   GNU General Public License for more details.
13
13
 
14
14
   You should have received a copy of the GNU General Public License
15
 
   along with this program; if not, write to the Free Software Foundation,
16
 
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
15
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
16
 
18
17
/* Written by Jim Meyering.  */
19
18
 
36
35
    {
37
36
      int i;
38
37
      for (i = 0; i < 2; i++)
39
 
        {
40
 
          fd[i] = fd_safer (fd[i]);
41
 
          if (fd[i] < 0)
42
 
            {
43
 
              int e = errno;
44
 
              close (fd[1 - i]);
45
 
              errno = e;
46
 
              return -1;
47
 
            }
48
 
        }
 
38
        {
 
39
          fd[i] = fd_safer (fd[i]);
 
40
          if (fd[i] < 0)
 
41
            {
 
42
              int e = errno;
 
43
              close (fd[1 - i]);
 
44
              errno = e;
 
45
              return -1;
 
46
            }
 
47
        }
49
48
 
50
49
      return 0;
51
50
    }