bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix lib/af_alg.c compilation error on Ubuntu Trusty


From: Peter Simons
Subject: Fix lib/af_alg.c compilation error on Ubuntu Trusty
Date: Sat, 02 Jun 2018 13:35:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 will not compile this file
without this patch.

>From e8703cf52d88e1c9833753cfa446b48394a0195b Mon Sep 17 00:00:00 2001
From: Peter Simons <address@hidden>
Date: Sat, 2 Jun 2018 13:32:25 +0200
Subject: [PATCH] lib/af_alg.c: 'for' loop initial declarations are only
 allowed in C99 mode

---
 lib/af_alg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/af_alg.c b/lib/af_alg.c
index ded4b326b..45df62c80 100644
--- a/lib/af_alg.c
+++ b/lib/af_alg.c
@@ -45,7 +45,8 @@ alg_socket (char const *alg)
     .salg_type = "hash",
   };
   /* Avoid calling both strcpy and strlen.  */
-  for (int i = 0; (salg.salg_name[i] = alg[i]); i++)
+  int i;
+  for (i = 0; (salg.salg_name[i] = alg[i]); i++)
     if (i == sizeof salg.salg_name - 1)
       return -EINVAL;
 
-- 
2.16.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]