This is an automated email from the git hooks/post-receive script.
spichugi pushed a commit to branch 389-ds-base-1.4.2
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.2 by this push:
new 6023396 Issue 50984 - Fix disk_mon_check_diskspace types
6023396 is described below
commit 6023396b7cdc149ce42f8a50558dccbf76a502cc
Author: Simon Pichugin <spichugi(a)redhat.com>
AuthorDate: Wed Jul 15 21:25:00 2020 +0200
Issue 50984 - Fix disk_mon_check_diskspace types
Description: Function parameters are inconsistence.
Documentation states that threshold should be from 0 to 2^63 - 1
so we can use uint64_t for that.
https://pagure.io/389-ds-base/issue/50984
Reviewed by: firstyear (Thanks!)
---
ldap/servers/slapd/daemon.c | 6 +++---
ldap/servers/slapd/libglobs.c | 6 +++---
ldap/servers/slapd/main.c | 2 +-
ldap/servers/slapd/proto-slap.h | 3 ++-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index d75ca9e..81a7098 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -345,8 +345,8 @@ disk_mon_check_diskspace(char **dirs, uint64_t threshold, uint64_t
*disk_space)
uint64_t freeBytes = 0;
uint64_t blockSize = 0;
char *worst_dir = NULL;
- int hit_threshold = 0;
- int i = 0;
+ int32_t hit_threshold = 0;
+ int32_t i = 0;
for (i = 0; dirs && dirs[i]; i++) {
if (statvfs(dirs[i], &buf) != -1) {
@@ -396,7 +396,7 @@ disk_monitoring_thread(void *nothing __attribute__((unused)))
char *dirstr = NULL;
uint64_t previous_mark = 0;
uint64_t disk_space = 0;
- int64_t threshold = 0;
+ uint64_t threshold = 0;
uint64_t halfway = 0;
time_t start = 0;
time_t now = 0;
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index d9225a3..cc88536 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1981,7 +1981,7 @@ config_set_disk_threshold(const char *attrname, char *value, char
*errorbuf, int
if (apply) {
CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->disk_threshold = threshold;
+ slapdFrontendConfig->disk_threshold = (uint64_t)threshold;
CFG_UNLOCK_WRITE(slapdFrontendConfig);
}
@@ -5107,11 +5107,11 @@ config_get_disk_grace_period()
return retVal;
}
-PRInt64
+uint64_t
config_get_disk_threshold()
{
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- PRInt64 retVal;
+ uint64_t retVal;
CFG_LOCK_READ(slapdFrontendConfig);
retVal = slapdFrontendConfig->disk_threshold;
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index 818970b..8e07f2d 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -894,7 +894,7 @@ main(int argc, char **argv)
char **dirs = NULL;
char *dirstr = NULL;
uint64_t disk_space = 0;
- int64_t threshold = 0;
+ uint64_t threshold = 0;
uint64_t halfway = 0;
threshold = config_get_disk_threshold();
halfway = threshold / 2;
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index ac02618..7134b69 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -543,7 +543,7 @@ void config_set_auditlog_enabled(int value);
void config_set_auditfaillog_enabled(int value);
int config_get_accesslog_logging_enabled(void);
int config_get_disk_monitoring(void);
-PRInt64 config_get_disk_threshold(void);
+uint64_t config_get_disk_threshold(void);
int config_get_disk_grace_period(void);
int config_get_disk_logging_critical(void);
int config_get_ndn_cache_count(void);
@@ -1499,6 +1499,7 @@ void slapd_do_nothing(int);
void slapd_wait4child(int);
void disk_mon_get_dirs(char ***list);
int32_t disk_get_info(char *dir, uint64_t *total_space, uint64_t *avail_space, uint64_t
*used_space);
+char *disk_mon_check_diskspace(char **dirs, uint64_t threshold, uint64_t *disk_space);
/*
* main.c
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.