removed main.c's extra warning messages when doing exit(EXIT_FAILURE)

This commit is contained in:
Fufu Fang 2019-10-22 01:13:28 +01:00
parent 65a9e7f908
commit dec32b0bb4
No known key found for this signature in database
GPG Key ID: 0F6BB5EF6F8BB729
4 changed files with 12 additions and 6 deletions

View File

@ -284,7 +284,7 @@ void LinkTable_free(LinkTable *linktbl)
free(linktbl);
}
static void LinkTable_print(LinkTable *linktbl)
void LinkTable_print(LinkTable *linktbl)
{
int j = 0;
fprintf(stderr, "--------------------------------------------\n");

View File

@ -154,4 +154,9 @@ LinkTable *LinkTable_alloc(const char *url);
*/
void LinkTable_free(LinkTable *linktbl);
/**
* \brief print a LinkTable
*/
void LinkTable_print(LinkTable *linktbl);
#endif

View File

@ -20,7 +20,7 @@ int main(int argc, char **argv)
if (argc < 2) {
print_help(argv[0], 0);
fprintf(stderr, "For more information, run \"%s --help.\"\n", argv[0]);
exit_failure();
exit(EXIT_FAILURE);
}
/* These are passed into fuse initialiser */
@ -62,11 +62,11 @@ int main(int argc, char **argv)
if (strncmp(base_url, "http://", 7) && strncmp(base_url, "https://", 8)) {
fprintf(stderr, "Error: Please supply a valid URL.\n");
print_help(argv[0], 0);
exit_failure();
exit(EXIT_FAILURE);
} else {
if(!network_init(base_url)) {
fprintf(stderr, "Error: Network initialisation failed.\n");
exit_failure();
exit(EXIT_FAILURE);
}
}

View File

@ -4,7 +4,7 @@
#include "link.h"
#include "network.h"
#include <expat.h>
#include <string.h>
#include <stdlib.h>
@ -97,8 +97,9 @@ LinkTable *sonic_LinkTable_new(const int id)
return NULL;
}
printf("%s", buf.memory);
free(buf.memory);
free(url);
return NULL;
}