summaryrefslogtreecommitdiffstats
path: root/unix
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
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')
-rw-r--r--unix/.cvsignore7
-rw-r--r--unix/tclUnixFile.c4
-rw-r--r--unix/tclUnixNotfy.c14
-rw-r--r--unix/tclUnixPipe.c13
4 files changed, 29 insertions, 9 deletions
diff --git a/unix/.cvsignore b/unix/.cvsignore
index 97b5f50..516d2b3 100644
--- a/unix/.cvsignore
+++ b/unix/.cvsignore
@@ -6,3 +6,10 @@ tclConfig.sh
autom4te.cache
tcl.pc
tclsh.exe
+cat
+dltest.marker
+longfile
+tclsh
+tcltest
+test1
+test2
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index c8ac03a..a656f4c 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixFile.c,v 1.55 2009/08/02 12:08:17 dkf Exp $
+ * RCS: @(#) $Id: tclUnixFile.c,v 1.56 2009/12/16 23:26:00 nijtmans Exp $
*/
#include "tclInt.h"
@@ -568,7 +568,7 @@ NativeMatchType(
*----------------------------------------------------------------------
*/
-char *
+const char *
TclpGetUserHome(
const char *name, /* User name for desired home directory. */
Tcl_DString *bufferPtr) /* Uninitialized or free DString filled with
diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c
index edcd884..3be0bb9 100644
--- a/unix/tclUnixNotfy.c
+++ b/unix/tclUnixNotfy.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: tclUnixNotfy.c,v 1.39 2009/04/10 18:02:37 das Exp $
+ * RCS: @(#) $Id: tclUnixNotfy.c,v 1.40 2009/12/16 23:26:00 nijtmans Exp $
*/
#include "tclInt.h"
@@ -291,7 +291,9 @@ Tcl_FinalizeNotifier(
* processes had terminated. [Bug: 4139] [Bug: 1222872]
*/
- write(triggerPipe, "q", 1);
+ if (write(triggerPipe, "q", 1) != 1) {
+ Tcl_Panic("Tcl_FinalizeNotifier: unable to write q to triggerPipe");
+ }
close(triggerPipe);
while(triggerPipe >= 0) {
Tcl_ConditionWait(&notifierCV, &notifierMutex, NULL);
@@ -782,7 +784,9 @@ Tcl_WaitForEvent(
waitingListPtr = tsdPtr;
tsdPtr->onList = 1;
- write(triggerPipe, "", 1);
+ if (write(triggerPipe, "", 1) != 1) {
+ Tcl_Panic("Tcl_FinalizeNotifier: unable to write to triggerPipe");
+ }
}
FD_ZERO(&(tsdPtr->readyMasks.readable));
@@ -812,7 +816,9 @@ Tcl_WaitForEvent(
}
tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
tsdPtr->onList = 0;
- write(triggerPipe, "", 1);
+ if (write(triggerPipe, "", 1) != 1) {
+ Tcl_Panic("Tcl_FinalizeNotifier: unable to write to triggerPipe");
+ }
}
#else
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);
}