uwrap: Add libc_setregid().
authorAndreas Schneider <asn@samba.org>
Tue, 17 Dec 2013 12:28:37 +0000 (13:28 +0100)
committerAndreas Schneider <asn@samba.org>
Tue, 17 Dec 2013 12:40:14 +0000 (13:40 +0100)
src/uid_wrapper.c

index 350611c3f44b86d63905dba75de327f84722ebe2..8b9cf20065f6ea517ee39a190eceae8de22ae8c0 100644 (file)
@@ -319,6 +319,15 @@ static int libc_setegid(gid_t egid)
 }
 #endif
 
+#ifdef HAVE_SETREGID
+static int libc_setregid(gid_t rgid, gid_t egid)
+{
+       uwrap_load_lib_function(UWRAP_LIBC, setregid);
+
+       return uwrap.libc.fns._libc_setregid(rgid, egid);
+}
+#endif
+
 static void *uwrap_libc_fn(struct uwrap *u, const char *fn_name)
 {
        void *func;
@@ -364,9 +373,6 @@ static void uwrap_libc_init(struct uwrap *u)
        }
 #endif
 
-#ifdef HAVE_SETREGID
-       *(void **) (&u->libc.fns._libc_setregid) = uwrap_libc_fn(u, "setregid");
-#endif
 #ifdef HAVE_SETRESGID
        *(void **) (&u->libc.fns._libc_setresgid) = uwrap_libc_fn(u, "setresgid");
 #endif
@@ -779,7 +785,7 @@ int setegid(gid_t egid)
 int setregid(gid_t rgid, gid_t egid)
 {
        if (!uwrap_enabled()) {
-               return uwrap.libc.fns._libc_setregid(rgid, egid);
+               return libc_setregid(rgid, egid);
        }
 
        return uwrap_setresgid(rgid, egid, -1);