]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/test-network.c
networks: Improve parsing IP addresses
[people/ms/libloc.git] / src / test-network.c
index e908b57b8383ae23fe9f4e71f89465955bbe0249..85eca000d5e36a92bf5fbbdff584057eebd372c2 100644 (file)
@@ -168,6 +168,13 @@ int main(int argc, char** argv) {
                exit(EXIT_FAILURE);
        }
 
+       // Try adding a single address
+       err = loc_writer_add_network(writer, &network, "2001:db8::");
+       if (err != -EINVAL) {
+               fprintf(stderr, "It was possible to add an invalid network (err = %d)\n", err);
+               exit(EXIT_FAILURE);
+       }
+
        FILE* f = tmpfile();
        if (!f) {
                fprintf(stderr, "Could not open file for writing: %s\n", strerror(errno));