diff options
| author | Matthias Schiffer | 2020-05-16 16:00:24 +0000 |
|---|---|---|
| committer | Matthias Schiffer | 2020-05-16 16:26:34 +0000 |
| commit | 112488bbbccc0581926b65ab093d495bff2dd8cf (patch) | |
| tree | 42c73ad1fdb5c241e302ff3646ffe04d301d6480 | |
| parent | 38dcb1a6f12115e156aa4f36997bd4760347e821 (diff) | |
| download | ucert-112488bbbccc0581926b65ab093d495bff2dd8cf.tar.gz | |
usign-exec: do not close stdin and stderr before exec
FDs 0, 1 and 2 should always be available. This also allows the exec error
message in the forked process to be displayed.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
| -rw-r--r-- | usign-exec.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usign-exec.c b/usign-exec.c index 22fdc14..436c627 100644 --- a/usign-exec.c +++ b/usign-exec.c @@ -46,7 +46,7 @@ int _usign_key_is_revoked(const char *fingerprint, const char *pubkeydir) { #ifdef UCERT_FULL /* * call usign -S ... - * return WEXITSTATUS or -1 if fork or execv fails + * return WEXITSTATUS or -1 if fork fails */ int usign_s(const char *msgfile, const char *seckeyfile, const char *sigfile, bool quiet) { pid_t pid; @@ -92,7 +92,7 @@ int usign_s(const char *msgfile, const char *seckeyfile, const char *sigfile, bo /* * call usign -F ... and set fingerprint returned - * return WEXITSTATUS or -1 if fork or execv fails + * return WEXITSTATUS or -1 if fork fails */ static int usign_f(char *fingerprint, const char *pubkeyfile, const char *seckeyfile, const char *sigfile, bool quiet) { int fds[2]; @@ -130,8 +130,6 @@ static int usign_f(char *fingerprint, const char *pubkeyfile, const char *seckey case 0: dup2(fds[1], 1); - close(0); - close(2); close(fds[0]); close(fds[1]); @@ -185,7 +183,7 @@ int usign_f_sig(char *fingerprint, const char *sigfile, bool quiet) { /* * call usign -V ... - * return WEXITSTATUS or -1 if fork or execv fails + * return WEXITSTATUS or -1 if fork fails */ int usign_v(const char *msgfile, const char *pubkeyfile, const char *pubkeydir, const char *sigfile, bool quiet) { |