summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixPipe.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2009-12-16 23:25:59 (GMT)
committernijtmans <nijtmans>2009-12-16 23:25:59 (GMT)
commitc09d5284e91311929d7e92c73492076e8a05cd36 (patch)
treeb7038bbc46d46d90860a433594776df4f31d744e /unix/tclUnixPipe.c
parentcf4896697457a54ad804eebeb31b63e27e41cb6c (diff)
downloadtcl-c09d5284e91311929d7e92c73492076e8a05cd36.zip
tcl-c09d5284e91311929d7e92c73492076e8a05cd36.tar.gz
tcl-c09d5284e91311929d7e92c73492076e8a05cd36.tar.bz2
Fix gcc warning: ignoring return value of ‘write’,
declared with attribute warn_unused_result CONSTify functions TclpGetUserHome and TclSetPreInitScript (TIP #27)
Diffstat (limited to 'unix/tclUnixPipe.c')
-rw-r--r--unix/tclUnixPipe.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index 69250f8..208b6d9 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixPipe.c,v 1.49 2009/11/09 13:47:23 dkf Exp $
+ * RCS: @(#) $Id: tclUnixPipe.c,v 1.50 2009/12/16 23:26:00 nijtmans Exp $
*/
#include "tclInt.h"
@@ -448,6 +448,7 @@ TclpCreateProcess(
pid = fork();
if (pid == 0) {
+ size_t len;
int joinThisError = errorFile && (errorFile == outputFile);
fd = GetFd(errPipeOut);
@@ -463,7 +464,10 @@ TclpCreateProcess(
((dup2(1,2) == -1) || (fcntl(2, F_SETFD, 0) != 0)))) {
sprintf(errSpace,
"%dforked process couldn't set up input/output: ", errno);
- (void) write(fd, errSpace, (size_t) strlen(errSpace));
+ len = strlen(errSpace);
+ if (len != (size_t) write(fd, errSpace, len)) {
+ Tcl_Panic("TclpCreateProcess: unable to write to errPipeOut");
+ }
_exit(1);
}
@@ -474,7 +478,10 @@ TclpCreateProcess(
RestoreSignals();
execvp(newArgv[0], newArgv); /* INTL: Native. */
sprintf(errSpace, "%dcouldn't execute \"%.150s\": ", errno, argv[0]);
- (void) write(fd, errSpace, (size_t) strlen(errSpace));
+ len = strlen(errSpace);
+ if (len != (size_t) write(fd, errSpace, len)) {
+ Tcl_Panic("TclpCreateProcess: unable to write to errPipeOut");
+ }
_exit(1);
}