mirror of
https://github.com/Motion-Project/motion.git
synced 2025-12-23 23:18:21 -05:00
Revert 20f3ba90a0
This commit is contained in:
31
src/util.cpp
31
src/util.cpp
@@ -134,29 +134,6 @@ void myunquote(std::string &parm)
|
||||
|
||||
}
|
||||
|
||||
/* Enclose and escape with single quotes */
|
||||
void myescquote(std::string &parm)
|
||||
{
|
||||
size_t plen, loc;
|
||||
std::string tparm;
|
||||
|
||||
mytrim(parm);
|
||||
|
||||
plen = parm.length();
|
||||
tparm ="'";
|
||||
loc = 0;
|
||||
while (loc < plen) {
|
||||
if (parm.substr(loc,1)== "'") {
|
||||
tparm += "'\''";
|
||||
} else {
|
||||
tparm += parm.substr(loc,1);
|
||||
}
|
||||
loc++;
|
||||
}
|
||||
tparm += "'";
|
||||
parm = tparm;
|
||||
}
|
||||
|
||||
/** mymalloc */
|
||||
void *mymalloc(size_t nbytes)
|
||||
{
|
||||
@@ -692,20 +669,16 @@ AVPacket *mypacket_alloc(AVPacket *pkt)
|
||||
void util_exec_command(cls_camera *cam, const char *command, const char *filename)
|
||||
{
|
||||
char stamp[PATH_MAX];
|
||||
std::string dst;
|
||||
int pid;
|
||||
|
||||
mystrftime(cam, stamp, sizeof(stamp), command, filename);
|
||||
|
||||
dst = stamp;
|
||||
myescquote(dst);
|
||||
|
||||
pid = fork();
|
||||
if (!pid) {
|
||||
/* Detach from parent */
|
||||
setsid();
|
||||
|
||||
execl("/bin/sh", "sh", "-c", dst.c_str(), " &",(char*)NULL);
|
||||
execl("/bin/sh", "sh", "-c", stamp, " &",(char*)NULL);
|
||||
|
||||
/* if above function succeeds the program never reach here */
|
||||
MOTION_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO
|
||||
@@ -730,8 +703,6 @@ void util_exec_command(cls_camera *cam, std::string cmd)
|
||||
|
||||
mystrftime(cam, dst, cmd, "");
|
||||
|
||||
myescquote(dst);
|
||||
|
||||
pid = fork();
|
||||
if (!pid) {
|
||||
/* Detach from parent */
|
||||
|
||||
@@ -101,7 +101,6 @@ struct ctx_params {
|
||||
void myrtrim(std::string &parm);
|
||||
void mytrim(std::string &parm);
|
||||
void myunquote(std::string &parm);
|
||||
void myescquote(std::string &parm);
|
||||
|
||||
void myframe_key(AVFrame *frame);
|
||||
void myframe_interlaced(AVFrame *frame);
|
||||
|
||||
Reference in New Issue
Block a user