[-]
[+]
|
Changed |
lfc.changes
|
|
[-]
[+]
|
Changed |
lfc.spec
^
|
|
[-]
[+]
|
Changed |
lfc-1.3.7.tar.bz2/README
^
|
@@ -4,9 +4,9 @@
------------------------------
A collection of basic c++ classes
- Version 1.3.5
+ Version 1.3.7
- (C)opyright 2005,2006,2007,2008,2009,2010,2011,2012 Bjoern Lemke
+ (C)opyright 2005,2006,2007,2008,2009,2010,2011,2012,2013 Bjoern Lemke
This software comes under the GNU general public license
|
[-]
[+]
|
Changed |
lfc-1.3.7.tar.bz2/src/CommandExecuter.cc
^
|
@@ -52,14 +52,15 @@
#include "CommandExecuter.h"
#include "Tokenizer.h"
+#include "File.h"
// DEFINES
-#define BUFLEN 100
#define SHELLPATH "/bin/bash"
#define SHELL "bash"
-CommandExecuter::CommandExecuter() : SigHandler()
-{
+CommandExecuter::CommandExecuter(const Chain& shellPath) : SigHandler()
+{
+ _shellPath = shellPath;
}
CommandExecuter::~CommandExecuter()
@@ -77,13 +78,25 @@
#else
+ File checkFile(_shellPath);
+ if (checkFile.exists() == false )
+ {
+ Chain msg = "Invalid execution shell path <" + _shellPath + ">";
+ throw Exception(EXLOC, msg);
+ }
+
+ Tokenizer argTok(_shellPath, Chain("/"));
+ Chain shellProg;
+ while ( argTok.nextToken(shellProg) );
+
alarm(0);
alarm(timeout);
install(SIGALRM);
- int pid;
- if ((pid = fork ()) > 0)
+ int pid = fork();
+
+ if ( pid > 0)
{
_childPid = pid;
@@ -103,20 +116,14 @@
else if (pid == 0)
{
char* argArray[4];
- argArray[0]=(char*)SHELL;
+ argArray[0]=(char*)shellProg;
argArray[1]=(char*)"-c";
argArray[2]=(char*)command;
argArray[3]=0;
-
int result;
- if ( (result = execv(SHELLPATH, argArray)) == -1 )
- {
- Chain msg = "Execution error : " + Chain(strerror(errno));
- throw Exception(EXLOC, msg);
- }
-
- exit (0);
+ result = execv(_shellPath, argArray);
+ exit (result);
}
else
{
|
[-]
[+]
|
Changed |
lfc-1.3.7.tar.bz2/src/CommandExecuter.h
^
|
@@ -47,13 +47,14 @@
public:
- CommandExecuter();
+ CommandExecuter(const Chain& shellPath = Chain("/bin/sh"));
~CommandExecuter();
int execute(const Chain& command, int timeout = DEFTIMEOUT);
private:
+ Chain _shellPath;
void sigCatch(int sig);
int _childPid;
};
|
[-]
[+]
|
Changed |
lfc-1.3.7.tar.bz2/src/Version.cc
^
|
@@ -6,7 +6,7 @@
//
// Design and Implementation by Bjoern Lemke
//
-// (C)opyright 2000-2012 Bjoern Lemke
+// (C)opyright 2000-2013 Bjoern Lemke
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -32,4 +32,4 @@
// Status: IMPLEMENTED
///////////////////////////////////////////////////////////////////////////////
-char __lfcVersionString[] = "1.3.5";
+char __lfcVersionString[] = "1.3.7";
|