summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:51:12 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:51:12 +0000
commit8b89e57fa2ae7d34b055b8f804cee0c2c194043b (patch)
treee064dc401cfa03ed15eaafbc746ecd9bb379a211 /methods
parent92173b19af439ac49d842902a3a57105d396d7d8 (diff)
Stable acquire code
Author: jgg Date: 1998-10-26 07:11:43 GMT Stable acquire code
Diffstat (limited to 'methods')
-rw-r--r--methods/copy.cc3
-rw-r--r--methods/gzip.cc14
2 files changed, 13 insertions, 4 deletions
diff --git a/methods/copy.cc b/methods/copy.cc
index c1cc26a69..b1c0fe360 100644
--- a/methods/copy.cc
+++ b/methods/copy.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: copy.cc,v 1.2 1998/10/25 07:07:29 jgg Exp $
+// $Id: copy.cc,v 1.3 1998/10/26 07:11:52 jgg Exp $
/* ######################################################################
Copy URI - This method takes a uri like a file: uri and copies it
@@ -121,6 +121,7 @@ int main()
TimeBuf.modtime = Buf.st_mtime;
if (utime(Target.c_str(),&TimeBuf) != 0)
{
+ To.OpFail();
_error->Errno("utime","Failed to set modification time");
Fail(URI);
continue;
diff --git a/methods/gzip.cc b/methods/gzip.cc
index 15bff4d83..84ad472e9 100644
--- a/methods/gzip.cc
+++ b/methods/gzip.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: gzip.cc,v 1.1 1998/10/25 07:07:30 jgg Exp $
+// $Id: gzip.cc,v 1.2 1998/10/26 07:11:53 jgg Exp $
/* ######################################################################
GZip method - Take a file URI in and decompress it into the target
@@ -123,20 +123,25 @@ int main()
{
dup2(From.Fd(),STDIN_FILENO);
dup2(To.Fd(),STDOUT_FILENO);
+ From.Close();
+ To.Close();
+ SetCloseExec(STDIN_FILENO,false);
+ SetCloseExec(STDOUT_FILENO,false);
const char *Args[3];
- Args[0] = _config->FindFile("Dir::bin::gzip","gzip").c_str();
+ Args[0] = _config->Find("Dir::bin::gzip","gzip").c_str();
Args[1] = "-d";
Args[2] = 0;
execvp(Args[0],(char **)Args);
+ exit(100);
}
From.Close();
- To.Close();
// Wait for gzip to finish
int Status;
if (waitpid(Process,&Status,0) != Process)
{
+ To.OpFail();
_error->Errno("wait","Waiting for gzip failed");
Fail(URI);
continue;
@@ -144,11 +149,14 @@ int main()
if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
{
+ To.OpFail();
_error->Error("gzip failed, perhaps the disk is full or the directory permissions are wrong.");
Fail(URI);
continue;
}
+ To.Close();
+
// Transfer the modification times
struct stat Buf;
if (stat(File.c_str(),&Buf) != 0)