From cec0300747391fadd836334d6f8c81ff83821ce8 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Sun, 25 Nov 2012 11:18:13 -0500 Subject: Carpet: Check return value of dup() --- Carpet/Carpet/src/TimerSet.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Carpet') diff --git a/Carpet/Carpet/src/TimerSet.cc b/Carpet/Carpet/src/TimerSet.cc index 0420a8262..ca9dc8077 100644 --- a/Carpet/Carpet/src/TimerSet.cc +++ b/Carpet/Carpet/src/TimerSet.cc @@ -124,7 +124,8 @@ namespace Carpet { return -1; } close (1); - dup (fdfile); // dup to 1, i.e., stdout again + int const fd = dup (fdfile); // dup to 1, i.e., stdout again + assert (fd == 1); close (fdfile); return oldfd; #endif @@ -139,7 +140,8 @@ namespace Carpet { #ifdef HAVE_UNISTD_H fflush (stdout); close (1); - dup (oldfd); + int const fd = dup (oldfd); + assert (fd == 1); close (oldfd); #endif } -- cgit v1.2.3