=== modified file 'plugins.d/mandos-client.c' --- plugins.d/mandos-client.c 2009-01-24 15:26:43 +0000 +++ plugins.d/mandos-client.c 2009-01-27 15:42:41 +0000 @@ -154,7 +154,7 @@ /* - * Helper function to insert pub and seckey to the enigne keyring. + * Helper function to insert pub and seckey to the engine keyring. */ bool import_key(const char *filename){ int fd; @@ -832,6 +832,7 @@ gid_t gid; char *connect_to = NULL; char tempdir[] = "/tmp/mandosXXXXXX"; + bool tempdir_created = false; AvahiIfIndex if_index = AVAHI_IF_UNSPEC; const char *seckey = PATHDIR "/" SECKEY; const char *pubkey = PATHDIR "/" PUBKEY; @@ -981,9 +982,9 @@ if(mkdtemp(tempdir) == NULL){ perror("mkdtemp"); - tempdir[0] = '\0'; goto end; } + tempdir_created = true; if(not init_gpgme(&mc, pubkey, seckey, tempdir)){ fprintf(stderr, "init_gpgme failed\n"); @@ -996,7 +997,8 @@ if_index = (AvahiIfIndex) if_nametoindex(interface); if(if_index == 0){ fprintf(stderr, "No such interface: \"%s\"\n", interface); - exit(EXIT_FAILURE); + exitcode = EXIT_FAILURE; + goto end; } if(connect_to != NULL){ @@ -1117,7 +1119,7 @@ } /* Removes the temp directory used by GPGME */ - if(tempdir[0] != '\0'){ + if(tempdir_created){ DIR *d; struct dirent *direntry; d = opendir(tempdir);