Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Add error checking on a new write() call.



Silences a compiler warning (write(2) is declared with warn_unused_result
in current Debian Unstable).
---
This is mainly in order to make the build more warning-free, since that
write(2) call isn't _that_ likely to fail in practice.

Cheers,

Daniel

 Src/exec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Src/exec.c b/Src/exec.c
index a667b078d..1d537af24 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2745,7 +2745,10 @@ execcmd_fork(Estate state, int how, int type, Wordcode varspc,
 	flags |= ESUB_JOB_CONTROL;
     *filelistp = jobtab[thisjob].filelist;
     entersubsh(flags, &esret);
-    write(synch[1], &esret, sizeof(esret));
+    if (write_loop(synch[1], (const void *) &esret, sizeof(esret)) != sizeof(esret)) {
+	zerr("Failed to send entersubsh_ret report: %e", errno);
+	return -1;
+    }
     close(synch[1]);
     zclose(close_if_forked);
 



Messages sorted by: Reverse Date, Date, Thread, Author