summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-11-28 15:46:31 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2015-11-28 15:46:31 +0100
commitd29d27b5513735bdb0f77505f5124b1bed390a17 (patch)
tree197024ee9db6a790e0bd1089837e17e456baf6de
parentebca2f254ca96ad7ad855dca6e76c9d1c792c4a0 (diff)
fix program name detection in rsh method
Regression intoduced in 23e64f6d0facf9610c1042326ad9850e071e8349
-rw-r--r--methods/rsh.cc9
-rw-r--r--methods/rsh.h3
2 files changed, 6 insertions, 6 deletions
diff --git a/methods/rsh.cc b/methods/rsh.cc
index bcd688833..9d82a99e3 100644
--- a/methods/rsh.cc
+++ b/methods/rsh.cc
@@ -34,7 +34,6 @@
#include <apti18n.h>
/*}}}*/
-const char *Prog;
unsigned long TimeOut = 120;
Configuration::Item const *RshOptions = 0;
time_t RSHMethod::FailTime = 0;
@@ -44,8 +43,8 @@ int RSHMethod::FailFd = -1;
// RSHConn::RSHConn - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-RSHConn::RSHConn(URI Srv) : Len(0), WriteFd(-1), ReadFd(-1),
- ServerName(Srv), Process(-1) {
+RSHConn::RSHConn(std::string const &pProg, URI Srv) : Len(0), WriteFd(-1), ReadFd(-1),
+ ServerName(Srv), Prog(pProg), Process(-1) {
Buffer[0] = '\0';
}
/*}}}*/
@@ -128,7 +127,7 @@ bool RSHConn::Connect(std::string Host, unsigned int Port, std::string User)
// Probably should do
// dup2(open("/dev/null",O_RDONLY),STDERR_FILENO);
- Args[i++] = Prog;
+ Args[i++] = Prog.c_str();
// Insert user-supplied command line options
Configuration::Item const *Opts = RshOptions;
@@ -443,7 +442,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
// Connect to the server
if (Server == 0 || Server->Comp(Get) == false) {
delete Server;
- Server = new RSHConn(Get);
+ Server = new RSHConn(Prog, Get);
}
// Could not connect is a transient error..
diff --git a/methods/rsh.h b/methods/rsh.h
index 35cbee3e0..64a5cf661 100644
--- a/methods/rsh.h
+++ b/methods/rsh.h
@@ -25,6 +25,7 @@ class RSHConn
int WriteFd;
int ReadFd;
URI ServerName;
+ std::string const Prog;
// Private helper functions
bool ReadLine(std::string &Text);
@@ -49,7 +50,7 @@ class RSHConn
bool Get(const char *Path,FileFd &To,unsigned long long Resume,
Hashes &Hash,bool &Missing, unsigned long long Size);
- explicit RSHConn(URI Srv);
+ RSHConn(std::string const &Prog, URI Srv);
~RSHConn();
};