Switch to unified view

a/src/utils/execmd.cpp b/src/utils/execmd.cpp
...
...
240
    // Close all descriptors except 0,1,2
240
    // Close all descriptors except 0,1,2
241
    libclf_closefrom(3);
241
    libclf_closefrom(3);
242
242
243
    execve(cmd.c_str(), (char *const*)argv, (char *const*)envv);
243
    execve(cmd.c_str(), (char *const*)argv, (char *const*)envv);
244
    // Hu ho
244
    // Hu ho
245
    LOGERR(("ExecCmd::doexec: execvp(%s) failed. errno %d\n", cmd.c_str(),
245
    LOGERR(("ExecCmd::doexec: execve(%s) failed. errno %d\n", cmd.c_str(),
246
        errno));
246
        errno));
247
    _exit(127);
247
    _exit(127);
248
}
248
}
249
249
250
int ExecCmd::startExec(const string &cmd, const vector<string>& args,
250
int ExecCmd::startExec(const string &cmd, const vector<string>& args,
...
...
632
    m_pid = -1;
632
    m_pid = -1;
633
    return true;
633
    return true;
634
    }
634
    }
635
}
635
}
636
636
637
// Static
638
bool ExecCmd::backtick(const std::vector<std::string> cmd, std::string& out)
639
{
640
    vector<string>::const_iterator it = cmd.begin();
641
    it++;
642
    vector<string> args(it, cmd.end());
643
    ExecCmd mexec;
644
    int status = mexec.doexec(*cmd.begin(), args, 0, &out);
645
    return status == 0;
646
}
647
648
/// ReExec class methods ///////////////////////////////////////////////////
637
ReExec::ReExec(int argc, char *args[])
649
ReExec::ReExec(int argc, char *args[])
638
{
650
{
639
    init(argc, args);
651
    init(argc, args);
640
}
652
}
641
653
...
...
745
    }
757
    }
746
    argv[i] = 0;
758
    argv[i] = 0;
747
    execvp(m_argv[0].c_str(), (char *const*)argv);
759
    execvp(m_argv[0].c_str(), (char *const*)argv);
748
}
760
}
749
761
762
750
////////////////////////////////////////////////////////////////////
763
////////////////////////////////////////////////////////////////////
751
#else // TEST
764
#else // TEST
752
#include <stdio.h>
765
#include <stdio.h>
753
#include <stdlib.h>
766
#include <stdlib.h>
767
#include <unistd.h>
768
#include <string.h>
769
754
#include <string>
770
#include <string>
755
#include <iostream>
771
#include <iostream>
756
#include <vector>
772
#include <vector>
773
using namespace std;
774
757
#include "debuglog.h"
775
#include "debuglog.h"
758
#include "cancelcheck.h"
776
#include "cancelcheck.h"
759
760
using namespace std;
761
762
#include "execmd.h"
777
#include "execmd.h"
763
778
764
static int     op_flags;
779
static int     op_flags;
765
#define OPT_MOINS 0x1
780
#define OPT_MOINS 0x1
766
#define OPT_b     0x4 
781
#define OPT_b     0x4