diff --git a/build-aux/bracket-spacing.pl b/build-aux/bracket-spacing.pl index d3a916f4b0..fbe66669ea 100755 --- a/build-aux/bracket-spacing.pl +++ b/build-aux/bracket-spacing.pl @@ -109,6 +109,27 @@ foreach my $file (@ARGV) { $ret = 1; last; } + + # Forbid whitespace before ";". Things like below are allowed: + # + # 1) The expression is empty for "for" loop. E.g. + # for (i = 0; ; i++) + # + # 2) An empty statement. E.g. + # while (write(statuswrite, &status, 1) == -1 && + # errno == EINTR) + # ; + # + # 3) ";" is inside double-quote, I.e, as part of const string. E.g. + # printf("%s", "a ; b\n"); + while ($data =~ /[^;\s]\s+;/) { + # Inside the double-quote + if ($data !~ /"[^"]*\s;/) { + print "$file:$.: $line"; + $ret = 1; + } + last; + } } close FILE; } diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index 1a7ccb8732..305eee95b4 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -292,7 +292,7 @@ static int virNetTLSContextCheckCertKeyPurpose(gnutls_x509_crt_t cert, bool allowClient = false, allowServer = false; critical = 0; - for (i = 0 ; ; i++) { + for (i = 0; ; i++) { size = 0; status = gnutls_x509_crt_get_key_purpose_oid(cert, i, buffer, &size, NULL);