X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/52b27d11fc50ebc4f1fc54b53fd9437d62dd7f4a..e76768c97a70934b8f3a41fe2df705c61a924a47:/tcpdump.c diff --git a/tcpdump.c b/tcpdump.c index 95b5ac0a..d9f3e0fa 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -652,7 +652,7 @@ show_devices_and_exit (void) #define OPTION_VERSION 129 #define OPTION_TSTAMP_PRECISION 130 -static struct option longopts[] = { +static const struct option longopts[] = { #if defined(HAVE_PCAP_CREATE) || defined(WIN32) { "buffer-size", required_argument, NULL, 'B' }, #endif @@ -713,7 +713,10 @@ droproot(const char *username, const char *chroot_dir) #ifdef HAVE_CAP_NG_H int ret = capng_change_id(pw->pw_uid, pw->pw_gid, CAPNG_NO_FLAG); if (ret < 0) { - printf("error : ret %d\n", ret); + fprintf(stderr, "error : ret %d\n", ret); + } + else { + printf("dropped privs to %s\n", username); } /* We don't need CAP_SETUID and CAP_SETGID */ capng_update(CAPNG_DROP, CAPNG_EFFECTIVE, CAP_SETUID); @@ -732,6 +735,9 @@ droproot(const char *username, const char *chroot_dir) pcap_strerror(errno)); exit(1); } + else { + printf("dropped privs to %s\n", username); + } #endif /* HAVE_CAP_NG_H */ } else {