Switch to unified view

a/src/execmd.cpp b/src/execmd.cpp
...
...
75
    int              m_timeoutMs;
75
    int              m_timeoutMs;
76
    int              m_rlimit_as_mbytes;
76
    int              m_rlimit_as_mbytes;
77
    string           m_stderrFile;
77
    string           m_stderrFile;
78
    // Pipe for data going to the command
78
    // Pipe for data going to the command
79
    int              m_pipein[2];
79
    int              m_pipein[2];
80
    STD_SHARED_PTR<NetconCli> m_tocmd;
80
    std::shared_ptr<NetconCli> m_tocmd;
81
    // Pipe for data coming out
81
    // Pipe for data coming out
82
    int              m_pipeout[2];
82
    int              m_pipeout[2];
83
    STD_SHARED_PTR<NetconCli> m_fromcmd;
83
    std::shared_ptr<NetconCli> m_fromcmd;
84
    // Subprocess id
84
    // Subprocess id
85
    pid_t            m_pid;
85
    pid_t            m_pid;
86
    // Saved sigmask
86
    // Saved sigmask
87
    sigset_t         m_blkcld;
87
    sigset_t         m_blkcld;
88
88
...
...
640
    if (has_input) {
640
    if (has_input) {
641
        close(m->m_pipein[0]);
641
        close(m->m_pipein[0]);
642
        m->m_pipein[0] = -1;
642
        m->m_pipein[0] = -1;
643
        NetconCli *iclicon = new NetconCli();
643
        NetconCli *iclicon = new NetconCli();
644
        iclicon->setconn(m->m_pipein[1]);
644
        iclicon->setconn(m->m_pipein[1]);
645
        m->m_tocmd = STD_SHARED_PTR<NetconCli>(iclicon);
645
        m->m_tocmd = std::shared_ptr<NetconCli>(iclicon);
646
    }
646
    }
647
    if (has_output) {
647
    if (has_output) {
648
        close(m->m_pipeout[1]);
648
        close(m->m_pipeout[1]);
649
        m->m_pipeout[1] = -1;
649
        m->m_pipeout[1] = -1;
650
        NetconCli *oclicon = new NetconCli();
650
        NetconCli *oclicon = new NetconCli();
651
        oclicon->setconn(m->m_pipeout[0]);
651
        oclicon->setconn(m->m_pipeout[0]);
652
        m->m_fromcmd = STD_SHARED_PTR<NetconCli>(oclicon);
652
        m->m_fromcmd = std::shared_ptr<NetconCli>(oclicon);
653
    }
653
    }
654
654
655
    /* Don't want to undo what we just did ! */
655
    /* Don't want to undo what we just did ! */
656
    e.inactivate();
656
    e.inactivate();
657
657
...
...
755
            NetconCli *oclicon = m->m_fromcmd.get();
755
            NetconCli *oclicon = m->m_fromcmd.get();
756
            if (!oclicon) {
756
            if (!oclicon) {
757
                LOGERR("ExecCmd::doexec: no connection from command\n");
757
                LOGERR("ExecCmd::doexec: no connection from command\n");
758
                return -1;
758
                return -1;
759
            }
759
            }
760
            oclicon->setcallback(STD_SHARED_PTR<NetconWorker>
760
            oclicon->setcallback(std::shared_ptr<NetconWorker>
761
                                 (new ExecReader(output, m->m_advise)));
761
                                 (new ExecReader(output, m->m_advise)));
762
            myloop.addselcon(m->m_fromcmd, Netcon::NETCONPOLL_READ);
762
            myloop.addselcon(m->m_fromcmd, Netcon::NETCONPOLL_READ);
763
            // Give up ownership
763
            // Give up ownership
764
            m->m_fromcmd.reset();
764
            m->m_fromcmd.reset();
765
        }
765
        }
...
...
768
            NetconCli *iclicon = m->m_tocmd.get();
768
            NetconCli *iclicon = m->m_tocmd.get();
769
            if (!iclicon) {
769
            if (!iclicon) {
770
                LOGERR("ExecCmd::doexec: no connection from command\n");
770
                LOGERR("ExecCmd::doexec: no connection from command\n");
771
                return -1;
771
                return -1;
772
            }
772
            }
773
            iclicon->setcallback(STD_SHARED_PTR<NetconWorker>
773
            iclicon->setcallback(std::shared_ptr<NetconWorker>
774
                                 (new ExecWriter(input, m->m_provide, m)));
774
                                 (new ExecWriter(input, m->m_provide, m)));
775
            myloop.addselcon(m->m_tocmd, Netcon::NETCONPOLL_WRITE);
775
            myloop.addselcon(m->m_tocmd, Netcon::NETCONPOLL_WRITE);
776
            // Give up ownership
776
            // Give up ownership
777
            m->m_tocmd.reset();
777
            m->m_tocmd.reset();
778
        }
778
        }