File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ int add_trusted_cert(struct vpn_config *cfg, const char *digest)
100100
101101 new = malloc (sizeof (struct x509_digest ));
102102 if (new == NULL )
103- return ERR_CFG_NO_MEM ;
103+ return - errno ;
104104
105105 new -> next = NULL ;
106106 strncpy (new -> data , digest , SHA256STRLEN - 1 );
@@ -194,7 +194,7 @@ int load_config(struct vpn_config *cfg, const char *filename)
194194
195195 file = fopen (filename , "r" );
196196 if (file == NULL ) {
197- ret = ERR_CFG_SEE_ERRNO ;
197+ ret = - errno ;
198198 goto err_return ;
199199 }
200200
@@ -482,7 +482,7 @@ int load_config(struct vpn_config *cfg, const char *filename)
482482 }
483483 }
484484 if (ferror (file ))
485- ret = ERR_CFG_SEE_ERRNO ;
485+ ret = - errno ;
486486
487487err_free :
488488 free (line );
Original file line number Diff line number Diff line change 2525#include <stdint.h>
2626#include <string.h>
2727
28- #define ERR_CFG_UNKNOWN -1
29- #define ERR_CFG_SEE_ERRNO -2
30- #define ERR_CFG_EMPTY_FILE -3
31- #define ERR_CFG_NO_MEM -4
32- #define ERR_CFG_CANNOT_READ -5
33-
34- static inline const char * err_cfg_str (int code )
35- {
36- if (code == ERR_CFG_SEE_ERRNO )
37- return strerror (errno );
38- else if (code == ERR_CFG_EMPTY_FILE )
39- return "Empty file" ;
40- else if (code == ERR_CFG_NO_MEM )
41- return "Not enough memory" ;
42- else if (code == ERR_CFG_CANNOT_READ )
43- return "Cannot read file" ;
44- return "unknown" ;
45- }
46-
4728#if HAVE_USR_SBIN_PPPD
4829#define PPP_DAEMON "pppd"
4930#else
Original file line number Diff line number Diff line change @@ -668,7 +668,7 @@ int main(int argc, char *argv[])
668668 log_debug ("Loaded configuration file \"%s\".\n" , config_file );
669669 else
670670 log_warn ("Could not load configuration file \"%s\" (%s).\n" ,
671- config_file , err_cfg_str ( ret ));
671+ config_file , strerror ( - ret ));
672672 }
673673 if (cli_cfg .password_set ) {
674674 if (cli_cfg .password [0 ] == '\0' )
You can’t perform that action at this time.
0 commit comments