r8580: try to fix the build on stratus
authorAndrew Tridgell <tridge@samba.org>
Tue, 19 Jul 2005 05:35:19 +0000 (05:35 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:29:40 +0000 (13:29 -0500)
(This used to be commit 58d7a1e6a311c98c9b4dfc9e280b328406165997)

source4/lib/replace/replace.c

index 89612912b723d115079c023d25d5931c1818eb57..79b452d69c513130c23f1f21a190c15b53e8b681 100644 (file)
@@ -191,16 +191,12 @@ Corrections by richard.kettlewell@kewill.com
 /****************************************************************************
  some systems don't have an initgroups call 
 ****************************************************************************/
- int initgroups(char *name,gid_t id)
+ int initgroups(char *name, gid_t id)
 {
 #ifndef HAVE_SETGROUPS
-       static int done;
-       if (!done) {
-               DEBUG(1,("WARNING: running without setgroups\n"));
-               done=1;
-       }
        /* yikes! no SETGROUPS or INITGROUPS? how can this work? */
-       return(0);
+       errno = ENOSYS;
+       return -1;
 #else /* HAVE_SETGROUPS */
        gid_t *grouplst = NULL;
        int max_gr = groups_max();
@@ -209,8 +205,8 @@ Corrections by richard.kettlewell@kewill.com
        struct group *g;
        char   *gr;
        
-       if((grouplst = malloc_array_p(gid_t, max_gr)) == NULL) {
-               DEBUG(0,("initgroups: malloc fail !\n"));
+       if((grouplst = malloc(sizeof(gid_t) * max_gr)) == NULL) {
+               errno = ENOMEM;
                return -1;
        }
 
@@ -232,8 +228,8 @@ Corrections by richard.kettlewell@kewill.com
                }
        }
        endgrent();
-       ret = sys_setgroups(i,grouplst);
-       SAFE_FREE(grouplst);
+       ret = setgroups(i, grouplst);
+       free(grouplst);
        return ret;
 #endif /* HAVE_SETGROUPS */
 }
@@ -429,7 +425,7 @@ duplicate a string
        if (!msg)
                return;
        syslog(facility_priority, "%s", msg);
-       SAFE_FREE(msg);
+       free(msg);
 }
 #endif /* HAVE_SYSLOG */
 #endif /* HAVE_VSYSLOG */