]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib/privs: display more info if cap_set_proc fails.
authorChristian Franke <nobody@nowhere.ws>
Wed, 13 May 2015 11:59:17 +0000 (13:59 +0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 9 Apr 2016 00:32:02 +0000 (20:32 -0400)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/privs.c

index f7269f4acce98a093edef619a6c01108af1f178c..3355f24a73499ed2ad2dc54ce1806fdfbd839be7 100644 (file)
@@ -299,7 +299,21 @@ zprivs_caps_init (struct zebra_privs_t *zprivs)
    */
   if ( cap_set_proc (zprivs_state.caps) ) 
     {
-      fprintf (stderr, "privs_init: initial cap_set_proc failed\n");
+      cap_t current_caps;
+      char *current_caps_text = NULL;
+      char *wanted_caps_text = NULL;
+
+      fprintf(stderr, "privs_init: initial cap_set_proc failed: %s\n",
+              safe_strerror(errno));
+
+      current_caps = cap_get_proc();
+      if (current_caps)
+          current_caps_text = cap_to_text(current_caps, NULL);
+
+      wanted_caps_text = cap_to_text(zprivs_state.caps, NULL);
+      fprintf(stderr, "Wanted caps: %s\n", wanted_caps_text ? wanted_caps_text : "???");
+      fprintf(stderr, "Have   caps: %s\n", current_caps_text ? current_caps_text : "???");
+
       exit (1);
     }