* [PATCH] Add error checking on a new write() call.
@ 2018-09-18 18:57 Daniel Shahaf
0 siblings, 0 replies; only message in thread
From: Daniel Shahaf @ 2018-09-18 18:57 UTC (permalink / raw)
To: zsh-workers
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-09-18 18:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 18:57 [PATCH] Add error checking on a new write() call Daniel Shahaf
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).