diff options
author | vkalintiris <vasilis@netdata.cloud> | 2024-02-12 15:20:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-12 15:20:17 +0200 |
commit | ce3724f1ddc4abde85c1a741f1bef972bd421ee9 (patch) | |
tree | e0e4a2f88392b17e78d3d7a61e97907211d74fbf /src | |
parent | 784849583616d51649c2de5a8b468db90e0c6132 (diff) |
Small cleanup (#16996)
* Remove unused header
* Mark functions as static.
Diffstat (limited to 'src')
-rw-r--r-- | src/collectors/cgroups.plugin/cgroup-network.c | 1 | ||||
-rw-r--r-- | src/daemon/daemon.c | 8 | ||||
-rw-r--r-- | src/daemon/daemon.h | 2 | ||||
-rw-r--r-- | src/database/rrdset.c | 1 |
4 files changed, 4 insertions, 8 deletions
diff --git a/src/collectors/cgroups.plugin/cgroup-network.c b/src/collectors/cgroups.plugin/cgroup-network.c index 07e7acd02e..085a6aa6f1 100644 --- a/src/collectors/cgroups.plugin/cgroup-network.c +++ b/src/collectors/cgroups.plugin/cgroup-network.c @@ -7,7 +7,6 @@ #ifndef _GNU_SOURCE #define _GNU_SOURCE /* See feature_test_macros(7) */ #endif -#include <sched.h> #endif char env_netdata_host_prefix[FILENAME_MAX + 50] = ""; diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 7dcca18cb5..d9a4b81de5 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c @@ -60,7 +60,7 @@ static void fix_directory_file_permissions(const char *dirname, uid_t uid, gid_t closedir(dir); } -void change_dir_ownership(const char *dir, uid_t uid, gid_t gid, bool recursive) +static void change_dir_ownership(const char *dir, uid_t uid, gid_t gid, bool recursive) { if (chown(dir, uid, gid) == -1) netdata_log_error("Cannot chown directory '%s' to %u:%u", dir, (unsigned int)uid, (unsigned int)gid); @@ -68,7 +68,7 @@ void change_dir_ownership(const char *dir, uid_t uid, gid_t gid, bool recursive) fix_directory_file_permissions(dir, uid, gid, recursive); } -void clean_directory(char *dirname) +static void clean_directory(char *dirname) { DIR *dir = opendir(dirname); if(!dir) return; @@ -84,7 +84,7 @@ void clean_directory(char *dirname) closedir(dir); } -void prepare_required_directories(uid_t uid, gid_t gid) { +static void prepare_required_directories(uid_t uid, gid_t gid) { change_dir_ownership(netdata_configured_cache_dir, uid, gid, true); change_dir_ownership(netdata_configured_varlib_dir, uid, gid, false); change_dir_ownership(netdata_configured_lock_dir, uid, gid, false); @@ -98,7 +98,7 @@ void prepare_required_directories(uid_t uid, gid_t gid) { clean_directory(netdata_configured_lock_dir); } -int become_user(const char *username, int pid_fd) { +static int become_user(const char *username, int pid_fd) { int am_i_root = (getuid() == 0)?1:0; struct passwd *pw = getpwnam(username); diff --git a/src/daemon/daemon.h b/src/daemon/daemon.h index bc584d2aff..1f8837fd6b 100644 --- a/src/daemon/daemon.h +++ b/src/daemon/daemon.h @@ -3,8 +3,6 @@ #ifndef NETDATA_DAEMON_H #define NETDATA_DAEMON_H 1 -int become_user(const char *username, int pid_fd); - int become_daemon(int dont_fork, const char *user); void netdata_cleanup_and_exit(int ret, const char *action, const char *action_result, const char *action_data); diff --git a/src/database/rrdset.c b/src/database/rrdset.c index b43e34bba8..096558d28f 100644 --- a/src/database/rrdset.c +++ b/src/database/rrdset.c @@ -2,7 +2,6 @@ #define NETDATA_RRD_INTERNALS #include "rrd.h" -#include <sched.h> #include "storage_engine.h" |