]> git.meshlink.io Git - meshlink/commitdiff
Check for astyle version 3 before formatting the code.
authorGuus Sliepen <guus@meshlink.io>
Tue, 12 Mar 2019 19:56:20 +0000 (20:56 +0100)
committerGuus Sliepen <guus@meshlink.io>
Tue, 12 Mar 2019 19:56:20 +0000 (20:56 +0100)
Unfortunately, code formatters change their behaviour between versions.
The code currently requires astyle version 3.x, so check this before
running astyle. If the wrong version is installed, print an error.

Makefile.am
test/blackbox/common/network_namespace_framework.c

index 4220d3c872487fcea41d6fc8fb6c76619ecd3ba7..44a5c8180f3aec9b0a2c6020420d591dfa706f4c 100644 (file)
@@ -20,6 +20,7 @@ ChangeLog:
        git log > ChangeLog
 
 astyle:
        git log > ChangeLog
 
 astyle:
+       @astyle --version | grep -q "Version 3" || (echo 'ERROR: astyle version 3 required!' 1>&2 && exit 1)
        astyle --options=.astylerc -nQ \
                src/*.[ch] \
                src/ed25519/e*.[ch] \
        astyle --options=.astylerc -nQ \
                src/*.[ch] \
                src/ed25519/e*.[ch] \
index 2cac3b2e054b7385d7ac85a5c445cd303c9cd7c5..d72286e9c5cd30875c4f97d11c99023702c3bb6e 100644 (file)
@@ -170,10 +170,12 @@ void netns_connect_namespaces(netns_state_t *test_state, namespace_t *ns1, names
                        }
 
                        interface->if_name = strdup(if_name);
                        }
 
                        interface->if_name = strdup(if_name);
+
                        assert(interface->if_name);
 
                        // Connect one end of the the veth pair to the namespace's interface
                        assert(sprintf(cmd, "ip link set %s netns %s name %s", eth_pairs[i], ns[i]->name, interface->if_name) >= 0);
                        assert(interface->if_name);
 
                        // Connect one end of the the veth pair to the namespace's interface
                        assert(sprintf(cmd, "ip link set %s netns %s name %s", eth_pairs[i], ns[i]->name, interface->if_name) >= 0);
+
                        assert(system(cmd) == 0);
                } else {
 
                        assert(system(cmd) == 0);
                } else {