1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-12-18 08:26:35 +01:00

better way to check if files exist

This commit is contained in:
Jfreegman
2014-08-27 22:45:11 -04:00
parent 155e194174
commit 511907fbc5
4 changed files with 22 additions and 18 deletions

View File

@@ -638,12 +638,9 @@ static void parse_args(int argc, char *argv[])
case 'c':
snprintf(arg_opts.config_path, sizeof(arg_opts.config_path), "%s", optarg);
FILE *conf_fp = fopen(arg_opts.config_path, "r");
if (conf_fp == NULL)
if (!file_exists(arg_opts.config_path))
queue_init_message("Config file not found");
else
fclose(conf_fp);
break;
@@ -670,12 +667,9 @@ static void parse_args(int argc, char *argv[])
case 'n':
snprintf(arg_opts.nodes_path, sizeof(arg_opts.nodes_path), "%s", optarg);
FILE *nodes_fp = fopen(arg_opts.nodes_path, "r");
if (nodes_fp == NULL)
if (!file_exists(arg_opts.nodes_path))
queue_init_message("DHTnodes file not found");
else
fclose(nodes_fp);
break;
@@ -696,12 +690,9 @@ static void parse_args(int argc, char *argv[])
case 'r':
snprintf(arg_opts.dns_path, sizeof(arg_opts.dns_path), "%s", optarg);
FILE *dns_fp = fopen(arg_opts.dns_path, "r");
if (dns_fp == NULL)
if (!file_exists(arg_opts.dns_path))
queue_init_message("DNSservers file not found");
else
fclose(dns_fp);
break;