mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 07:06:30 +00:00
completely avoid usage of strnlen()
This commit is contained in:
committed by
Jaime Casanova
parent
1c67e105ff
commit
24bd4e7a3f
2
config.c
2
config.c
@@ -140,7 +140,7 @@ parse_config(const char *config_file, t_configuration_options * options)
|
||||
fclose(fp);
|
||||
|
||||
/* Check config settings */
|
||||
if (strnlen(options->cluster_name, MAXLEN) == 0)
|
||||
if (*options->cluster_name == '\0')
|
||||
{
|
||||
log_err(_("Cluster name is missing. Check the configuration file.\n"));
|
||||
exit(ERR_BAD_CONFIG);
|
||||
|
||||
2
repmgr.c
2
repmgr.c
@@ -1948,7 +1948,7 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
|
||||
char host_string[MAXLEN];
|
||||
int r;
|
||||
|
||||
if (strnlen(options.rsync_options, MAXLEN) == 0)
|
||||
if (*options.rsync_options == '\0')
|
||||
maxlen_snprintf(
|
||||
rsync_flags, "%s",
|
||||
"--archive --checksum --compress --progress --rsh=ssh");
|
||||
|
||||
11
strutil.c
11
strutil.c
@@ -29,17 +29,6 @@ static int
|
||||
xvsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 0)));
|
||||
|
||||
/* Add strnlen on platforms that don't have it, like OS X */
|
||||
#ifndef strnlen
|
||||
size_t
|
||||
strnlen(const char *s, size_t n)
|
||||
{
|
||||
const char *end = (const char *) memchr(s, '\0', n);
|
||||
|
||||
return (end ? end - s : n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
xvsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
{
|
||||
|
||||
@@ -43,9 +43,4 @@ extern int
|
||||
maxlen_snprintf(char *str, const char *format,...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
|
||||
|
||||
/* Add strnlen on platforms that don't have it, like OS X */
|
||||
#ifndef strnlen
|
||||
extern size_t strnlen(const char *s, size_t n);
|
||||
#endif
|
||||
|
||||
#endif /* _STRUTIL_H_ */
|
||||
|
||||
Reference in New Issue
Block a user