~jr/ubuntu/oneiric/apt/bzr-get-rename

« back to all changes in this revision

Viewing changes to apt-inst/dirstream.cc

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2005-03-07 20:08:33 UTC
  • Revision ID: james.westby@ubuntu.com-20050307200833-0lxdgg2cb4oculdv
Tags: 0.6.35
* Merge apt--mvo--0 (incorporates 0.6.34ubuntu1):
  - Implement MaxSize and MaxAge in apt.cron.daily, to prevent the cache
    from growing too large (Ubuntu #6761)
  - some comments about the pkgAcqMetaSig::Custom600Headers() added
  - use gpg --with-colons
  - commented the ftp no_proxy unseting in methods/ftp.cc
  - added support for "Acquire::gpgv::options" in methods/gpgv.cc
* Merge bubulle@debian.org--2005/apt--main--0
  - Make capitalization more consistent
  - Un-fuzzy translations resulting from capitalization changes
  - Italian translation update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// -*- mode: cpp; mode: fold -*-
2
2
// Description                                                          /*{{{*/
3
 
// $Id: dirstream.cc,v 1.2 2001/02/20 07:03:16 jgg Exp $
 
3
// $Id: dirstream.cc,v 1.3.2.1 2004/01/16 18:58:50 mdz Exp $
4
4
/* ######################################################################
5
5
 
6
6
   Directory Stream 
24
24
#include <errno.h>
25
25
#include <utime.h>
26
26
#include <unistd.h>
 
27
#include <apti18n.h>
27
28
                                                                        /*}}}*/
28
29
 
29
30
// DirStream::DoItem - Process an item                                  /*{{{*/
41
42
         int iFd = open(Itm.Name,O_NDELAY|O_WRONLY|O_CREAT|O_TRUNC|O_APPEND,
42
43
                       Itm.Mode);
43
44
         if (iFd < 0)
44
 
            return _error->Errno("open","Failed write file %s",
 
45
            return _error->Errno("open",_("Failed write file %s"),
45
46
                                 Itm.Name);
46
47
         
47
48
         // fchmod deals with umask and fchown sets the ownership
48
49
         if (fchmod(iFd,Itm.Mode) != 0)
49
 
            return _error->Errno("fchmod","Failed write file %s",
 
50
            return _error->Errno("fchmod",_("Failed write file %s"),
50
51
                                 Itm.Name);
51
52
         if (fchown(iFd,Itm.UID,Itm.GID) != 0 && errno != EPERM)
52
 
            return _error->Errno("fchown","Failed write file %s",
 
53
            return _error->Errno("fchown",_("Failed write file %s"),
53
54
                                 Itm.Name);
54
55
         Fd = iFd;
55
56
         return true;
76
77
      return true;
77
78
   
78
79
   if (close(Fd) != 0)
79
 
      return _error->Errno("close","Failed to close file %s",Itm.Name);
 
80
      return _error->Errno("close",_("Failed to close file %s"),Itm.Name);
80
81
 
81
82
   /* Set the modification times. The only way it can fail is if someone
82
83
      has futzed with our file, which is intolerable :> */
84
85
   Time.actime = Itm.MTime;
85
86
   Time.modtime = Itm.MTime;
86
87
   if (utime(Itm.Name,&Time) != 0)
87
 
      _error->Errno("utime","Failed to close file %s",Itm.Name);
 
88
      _error->Errno("utime",_("Failed to close file %s"),Itm.Name);
88
89
   
89
90
   return true;   
90
91
}