From: Andrew Oates <[email protected]>

The usage of selfb, before, etc in this block do not match the
conditions where they are declared above.  Therefore, on a system (for
example) that has none of HAVE_GETRUSAGE, HAVE_GETTIMEOFDAY, nor
HAVE_TIMES defined, this will fail to compile.  Likewise, a system with
HAVE_GETRUSAGE but neither of the other two will also fail.

This updates the preprocessor conditions where the variables are used to
match where they are declared above.
---
 execute_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/execute_cmd.c b/execute_cmd.c
index e2e0b4f0..aba25fcd 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -1507,11 +1507,11 @@ time_command (COMMAND *command, int asynchronous, int 
pipe_in, int pipe_out, str
      obeys TIMEFORMAT. This is from POSIX interp 267 */
   if (posixly_correct && nullcmd)
     {
-#if defined (HAVE_GETRUSAGE)
+#if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY)
       selfb.ru_utime.tv_sec = kidsb.ru_utime.tv_sec = selfb.ru_stime.tv_sec = 
kidsb.ru_stime.tv_sec = 0;
       selfb.ru_utime.tv_usec = kidsb.ru_utime.tv_usec = selfb.ru_stime.tv_usec 
= kidsb.ru_stime.tv_usec = 0;
       before = shellstart;
-#else
+#elif defined (HAVE_TIMES)
       before.tms_utime = before.tms_stime = before.tms_cutime = 
before.tms_cstime = 0;
       tbefore = shell_start_time * get_clk_tck ();
 #endif
-- 
2.51.2


Reply via email to