]> git.meshlink.io Git - meshlink/blobdiff - test/encrypted.c
Don't use assert() to check the results of pthread_*() calls.
[meshlink] / test / encrypted.c
index a97e0eec1e1f63604808e553ab268a667db036a5..ac0dfa92023afdb77a47a49170444b76fc3eeb69 100644 (file)
@@ -8,11 +8,12 @@
 #include <errno.h>
 #include <sys/time.h>
 #include <assert.h>
+#include <dirent.h>
 
 #include "meshlink.h"
 #include "utils.h"
 
-int main() {
+int main(void) {
        meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb);
 
        // Open a new meshlink instance.
@@ -40,5 +41,15 @@ int main() {
        // Destroy the mesh.
 
        assert(meshlink_destroy("encrypted_conf"));
-       assert(access("encrypted_conf", F_OK) == -1 && errno == ENOENT);
+
+       DIR *dir = opendir("encrypted_conf");
+       assert(dir);
+       struct dirent *ent;
+
+       while((ent = readdir(dir))) {
+               fprintf(stderr, "%s\n", ent->d_name);
+               assert(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."));
+       }
+
+       closedir(dir);
 }