]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
load-tester: Fix load-tester on platforms where plain `char` is signed
authorTobias Brunner <tobias@strongswan.org>
Fri, 17 Jun 2016 08:22:25 +0000 (10:22 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 17 Jun 2016 08:22:25 +0000 (10:22 +0200)
fgetc() returns an int and EOF is usually -1 so when this gets casted to
a char the result depends on whether `char` means `signed char` or
`unsigned char` (the C standard does not specify it).  If it is unsigned
then its value is 0xff so the comparison with EOF will fail as that is an
implicit signed int.

src/libcharon/plugins/load_tester/load_tester.c

index f5a998ecc0f7f5ce5d2eb1e375e9ef874d739a35..94b934d09a92cba6a5f0e9044b48d8b95dcb249c 100644 (file)
@@ -65,7 +65,7 @@ static FILE* make_connection()
 static int initiate(unsigned int count, unsigned int delay)
 {
        FILE *stream;
-       char c;
+       int c;
 
        stream = make_connection();
        if (!stream)