]> git.proxmox.com Git - mirror_frr.git/commit - lib/privs.c
lib: add frr_elevate_privs() wrapper
authorDavid Lamparter <equinox@opensourcerouting.org>
Fri, 10 Aug 2018 15:35:29 +0000 (17:35 +0200)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 14 Aug 2018 20:02:05 +0000 (20:02 +0000)
commit6017c3a2e71304381af5cfa5020b4a1358ee098b
tree2b1aa729781515f759cead26ff44ca73d34b4faa
parent09c866e34dd6f1725ff5a2354017c13485c2c755
lib: add frr_elevate_privs() wrapper

Used as:
  frr_elevate_privs(&my_privs) {
    ... code ...
  }
and handles privilege raise/lower automatically in conjunction with the
C expression block.  This makes it impossible to accidentally exit a
function with privileges raised (and then running a whole bunch of other
code with privs.)

Signed-off-by: David Lamparter <equinox@diac24.net>
lib/privs.c
lib/privs.h