This function returns some value of enum HostsFileLoadResult,
but for reasons lost in the development process was declared to
return "int". Fix that, for clarity and so that our typedefs
collection tooling sees the typedef as used. Also fix the
variable that the sole call assigns into. Move the typedef
to the header file that declares load_hosts() to avoid creating
header dependency problems.
Discussion: https://postgr.es/m/359138.
1777922557@sss.pgh.pa.us
* the hosts configuration failed to load, the err_msg variable may have more
* information in case it was passed as non-NULL.
*/
-int
+HostsFileLoadResult
load_hosts(List **hosts, char **err_msg)
{
FILE *file;
MemoryContext host_memcxt = NULL;
MemoryContextCallback *host_memcxt_cb;
char *err_msg = NULL;
- int res;
+ HostsFileLoadResult res;
struct hosts *new_hosts;
SSL_CTX *context = NULL;
int ssl_ver_min = -1;
void *ssl_ctx; /* associated SSL_CTX* for the above settings */
} HostsLine;
-typedef enum HostsFileLoadResult
-{
- HOSTSFILE_LOAD_OK = 0,
- HOSTSFILE_LOAD_FAILED,
- HOSTSFILE_EMPTY,
- HOSTSFILE_MISSING,
- HOSTSFILE_DISABLED,
-} HostsFileLoadResult;
-
/*
* TokenizedAuthLine represents one line lexed from an authentication
* configuration file. Each item in the "fields" list is a sub-list of
PG_TLS1_3_VERSION,
};
+typedef enum HostsFileLoadResult
+{
+ HOSTSFILE_LOAD_OK = 0,
+ HOSTSFILE_LOAD_FAILED,
+ HOSTSFILE_EMPTY,
+ HOSTSFILE_MISSING,
+ HOSTSFILE_DISABLED,
+} HostsFileLoadResult;
+
/*
* prototypes for functions in be-secure-common.c
*/
char *buf, int size);
extern bool check_ssl_key_file_permissions(const char *ssl_key_file,
bool isServerStart);
-extern int load_hosts(List **hosts, char **err_msg);
+extern HostsFileLoadResult load_hosts(List **hosts, char **err_msg);
#endif /* LIBPQ_H */