* src/nethogs.h: Undo accidental commit.
* src/main.cpp: Properly commit this change.
This commit is contained in:
@@ -177,9 +177,11 @@ int main(int argc, char **argv) {
|
|||||||
if (geteuid() != 0)
|
if (geteuid() != 0)
|
||||||
forceExit(false, "You need to be root to run NetHogs!");
|
forceExit(false, "You need to be root to run NetHogs!");
|
||||||
#else
|
#else
|
||||||
|
char exe_path[PATH_MAX];
|
||||||
unsigned int caps[5] = {0};
|
unsigned int caps[5] = {0};
|
||||||
|
|
||||||
getxattr(argv[0], "security.capability", (char *)caps, sizeof(caps));
|
readlink("/proc/self/exe", exe_path, PATH_MAX);
|
||||||
|
getxattr(exe_path, "security.capability", (char *)caps, sizeof(caps));
|
||||||
|
|
||||||
if (((caps[1] >> CAP_NET_ADMIN) & 1) != 1)
|
if (((caps[1] >> CAP_NET_ADMIN) & 1) != 1)
|
||||||
forceExit(false, "You need to enable cap_net_admin (and cap_net_raw) to run NetHogs!");
|
forceExit(false, "You need to enable cap_net_admin (and cap_net_raw) to run NetHogs!");
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
* like www.adamantix.org: in that case nethogs shouldn't check if it's
|
* like www.adamantix.org: in that case nethogs shouldn't check if it's
|
||||||
* running as root. Take care to give it sufficient privileges though. */
|
* running as root. Take care to give it sufficient privileges though. */
|
||||||
#ifndef NEEDROOT
|
#ifndef NEEDROOT
|
||||||
#define NEEDROOT 0
|
#define NEEDROOT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
|
|||||||
Reference in New Issue
Block a user