Make `nd-run` silent unless exiting with an error (#21076)
Ilya Mashchenko committed
Sep 30, 2025 at 23:20 UTC
f736285e8f0b8256493ff38bf17d604da1df5f7f
1 file changed
-6
src/collectors/utils/nd-run.c
-6
@@ -148,8 +148,6 @@ int main(int argc, char *argv[]) {
148
149
struct passwd *pw = getpwnam(NETDATA_USER);
150
if (!pw) {
151
- fprintf(stderr, "User '%s' not found, falling back to '%s'\n",
152
- NETDATA_USER, FALLBACK_USER);
151
pw = getpwnam(FALLBACK_USER);
152
if (!pw) {
153
fprintf(stderr, "Fallback user '%s' not found either\n", FALLBACK_USER);
@@ -158,13 +156,9 @@ int main(int argc, char *argv[]) {
156
}
157
158
if (euid != pw->pw_uid) {
161
- fprintf(stderr, "Attempting to run as user: %s (UID=%d, GID=%d)\n", pw->pw_name, (int)pw->pw_uid, (int)pw->pw_gid);
162
-
159
// Set supplementary groups for this user (must be done before dropping privs)
160
if (initgroups(pw->pw_name, pw->pw_gid) != 0) {
161
if (euid == 0) {
166
- perror("initgroups");
167
-
162
if (setgroups(0, NULL) != 0) {
163
fatal("setgroups");
164
}