Switch to unified view

a/src/utils/execmd.cpp b/src/utils/execmd.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: execmd.cpp,v 1.19 2006-10-11 16:09:45 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: execmd.cpp,v 1.20 2006-11-30 13:38:44 dockes Exp $ (C) 2004 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
124
    LOGERR(("ExecCmd::doexec: fork(2) failed. errno %d\n", errno));
124
    LOGERR(("ExecCmd::doexec: fork(2) failed. errno %d\n", errno));
125
    return -1;
125
    return -1;
126
    }
126
    }
127
127
128
    if (e.pid) {
128
    if (e.pid) {
129
  // Ignore SIGPIPE in here.
130
  void (*osig)(int);
131
  osig = signal(SIGPIPE, SIG_IGN);
129
    // Father process
132
    // Father process
130
    if (input) {
133
    if (input) {
131
        close(e.pipein[0]);
134
        close(e.pipein[0]);
132
        e.pipein[0] = -1;
135
        e.pipein[0] = -1;
133
        fcntl(e.pipein[1], F_SETFL, O_NONBLOCK);
136
        fcntl(e.pipein[1], F_SETFL, O_NONBLOCK);
...
...
217
        }
220
        }
218
    }
221
    }
219
222
220
    out:
223
    out:
221
    int status = -1;
224
    int status = -1;
225
  signal(SIGPIPE, osig);
222
    if (!m_cancelRequest) {
226
    if (!m_cancelRequest) {
223
        (void)waitpid(e.pid, &status, 0);
227
        (void)waitpid(e.pid, &status, 0);
224
        e.pid = -1;
228
        e.pid = -1;
225
    }
229
    }
226
    LOGDEB1(("ExecCmd::doexec: father got status 0x%x\n", status));
230
    LOGDEB1(("ExecCmd::doexec: father got status 0x%x\n", status));