summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
authorMartin Winter <mwinter@opensourcerouting.org>2017-01-21 02:48:45 +0700
committerMartin Winter <mwinter@opensourcerouting.org>2017-01-26 00:45:05 +0700
commit38657f2ebd65fce3cfcba3ff4d29b29056af2df1 (patch)
tree2fbb6588bab2ec9ec3c513236beb409a3174e5e5 /lib/vty.c
parentce2e9ec3ad0e9bf8199da613cb72f70792469782 (diff)
lib: Don't change uid/gid if we are already the correct uid/gid
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/vty.c b/lib/vty.c
index adcfaca4f3..9594d68ebd 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2091,8 +2091,11 @@ vty_serv_un (const char *path)
umask (old_mask);
zprivs_get_ids(&ids);
-
- if (ids.gid_vty > 0)
+
+ /* Hack: ids.gid_vty is actually a uint, but we stored -1 in it
+ earlier for the case when we don't need to chown the file
+ type casting it here to make a compare */
+ if ((int)ids.gid_vty > 0)
{
/* set group of socket */
if ( chown (path, -1, ids.gid_vty) )