Switch to unified view

a/src/utils/execmd.h b/src/utils/execmd.h
...
...
202
    ExecCmd(const ExecCmd &) {}
202
    ExecCmd(const ExecCmd &) {}
203
    ExecCmd& operator=(const ExecCmd &) {return *this;};
203
    ExecCmd& operator=(const ExecCmd &) {return *this;};
204
};
204
};
205
205
206
206
207
/** Rexecute myself with the same arguments. 
208
 *
209
 * Note that there are some limitations:
210
 *  - argv[0] has to be valid: an executable name which will be found in 
211
 *    the path when exec is called in the initial working directory. This is 
212
 *    by no means guaranteed. The shells do this, but argv[0] could be an
213
 *    arbitrary string.
214
 *  - The initial working directory must be found and remain valid.
215
 *  - We don't try to do anything with fd 0,1,2. If they were changed by the
216
 *    program, their initial meaning won't be the same as at the moment of the 
217
 *    initial invocation.
218
 *  - We don't restore the signals. Signals set to be blocked 
219
 *    or ignored by the program will remain ignored even if this was not their
220
 *    initial state.
221
 *  - The environment is also not restored.
222
 *  - Others system aspects ?
223
 *  - Other program state: application-dependant
224
 * 
225
 * In short, this is usable in reasonably controlled situations and if there 
226
 * are no security issues involved, but this does not perform miracles.
227
 */
228
class ReExec {
229
public:
230
    ReExec() {}
231
    ReExec(int argc, char *argv[]);
232
    void init(int argc, char *argv[]);
233
    void reexec();
234
    const string& getreason() {return m_reason;}
235
private:
236
    vector<string> m_argv;
237
    string m_curdir;
238
    int    m_cfd;
239
    string m_reason;
240
};
241
207
#endif /* _EXECMD_H_INCLUDED_ */
242
#endif /* _EXECMD_H_INCLUDED_ */