@cryptotaxi247 / netdata-1 / commits / 6fe6b8b7c

do not instruct user to set capabilities on systems that do not have capabilities

Costa Tsaousis (ktsaou) committed Jan 29, 2017 at 21:20 UTC 6fe6b8b7c006988c8d3dcf77f98c81a9687feb5b
1 file changed +9
src/apps_plugin.c
+9
@@ -3138,12 +3138,21 @@ int main(int argc, char **argv) {
3138
3139 if(!am_i_running_as_root())
3140 if(!check_capabilities())
3141 +#ifdef HAVE_CAPABILITY
3142 error("apps.plugin should either run as root or have special capabilities. "
3143 "Without these, apps.plugin cannot report disk I/O utilization of other processes. "
3144 "To enable capabilities run: sudo setcap cap_dac_read_search,cap_sys_ptrace+ep %1$s; "
3145 "To enable setuid to root run: sudo chown root %1$s; sudo chmod 4755 %1$s; "
3146 , argv[0]
3147 );
3148 +#else
3149 + error("apps.plugin should either run as root or have special capabilities. "
3150 + "Without these, apps.plugin cannot report disk I/O utilization of other processes. "
3151 + "Your system does not support capabilities. "
3152 + "To enable setuid to root run: sudo chown root %1$s; sudo chmod 4755 %1$s; "
3153 + , argv[0]
3154 + );
3155 +#endif
3156
3157 all_pids_sortlist = callocz(sizeof(pid_t), (size_t)pid_max);
3158 all_pids = callocz(sizeof(struct pid_stat *), (size_t) pid_max);