[git commit 0_9_30] make test-skeleton C89 compliant

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Thu Dec 17 12:42:26 UTC 2009


commit: http://git.uclibc.org/uClibc/commit/?id=0aa968c23670a49de8b94858a2bd77a5e4baf193
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/0_9_30

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 test/test-skeleton.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/test-skeleton.c b/test/test-skeleton.c
index adfc8b7..5af846d 100644
--- a/test/test-skeleton.c
+++ b/test/test-skeleton.c
@@ -137,14 +137,15 @@ timeout_handler (int sig __attribute__ ((unused)))
 {
   int killed = 0;
   int status;
+  int i;
 
   /* Send signal.  */
   kill (pid, SIGKILL);
 
   /* Wait for it to terminate.  */
-  int i;
   for (i = 0; i < 5; ++i)
     {
+      struct timespec ts;
       killed = waitpid (pid, &status, WNOHANG|WUNTRACED);
       if (killed != 0)
 	break;
@@ -153,7 +154,6 @@ timeout_handler (int sig __attribute__ ((unused)))
 	 nanosleep() call return prematurely, all the better.  We
 	 won't restart it since this probably means the child process
 	 finally died.  */
-      struct timespec ts;
       ts.tv_sec = 0;
       ts.tv_nsec = 100000000;
       nanosleep (&ts, NULL);
@@ -203,6 +203,7 @@ main (int argc, char *argv[])
   int opt;
   unsigned int timeoutfactor = 1;
   pid_t termpid;
+  char *envstr_timeoutfactor;
 
   /* Make uses of freed and uninitialized memory known.  */
 #ifdef __MALLOC_STANDARD__
@@ -234,7 +235,7 @@ main (int argc, char *argv[])
 
   /* If set, read the test TIMEOUTFACTOR value from the environment.
      This value is used to scale the default test timeout values. */
-  char *envstr_timeoutfactor = getenv ("TIMEOUTFACTOR");
+  envstr_timeoutfactor = getenv ("TIMEOUTFACTOR");
   if (envstr_timeoutfactor != NULL)
     {
       char *envstr_conv = envstr_timeoutfactor;
@@ -293,6 +294,9 @@ main (int argc, char *argv[])
   if (pid == 0)
     {
       /* This is the child.  */
+#ifdef RLIMIT_DATA
+      struct rlimit data_limit;
+#endif
 #ifdef RLIMIT_CORE
       /* Try to avoid dumping core.  */
       struct rlimit core_limit;
@@ -303,7 +307,6 @@ main (int argc, char *argv[])
 
 #ifdef RLIMIT_DATA
       /* Try to avoid eating all memory if a test leaks.  */
-      struct rlimit data_limit;
       if (getrlimit (RLIMIT_DATA, &data_limit) == 0)
 	{
 	  if (TEST_DATA_LIMIT == RLIM_INFINITY)
-- 
1.6.3.3



More information about the uClibc-cvs mailing list