On Mon, 2008-11-03 at 16:45 -0500, Daniel Gruner wrote:
> Sorry, but the "fix" is not quite right. xuserset add -u goes into an
> infinite loop, printing the error message:
>
> xp_user_add: n0001: Error 5: root:user exists
>
> over and over. It never gets out of the loop to add other users in
> the passwd file.
>
> xgroupset seems ok.
>
> Daniel
sorry.
can you try this patch and tell me if it works fine for you?
Index: libxcpu/node.c
===================================================================
--- libxcpu/node.c (revision 722)
+++ libxcpu/node.c (working copy)
@@ -57,7 +57,7 @@
};
*/
-static Xpnodeerror *errorpool;
+static Xpnodeerror *errorpool = NULL;
Xpnode *
xp_node_create(char *name, char *addr, char *arch, char *status, int
numjobs)
@@ -169,8 +169,6 @@
prog, ne->node->name, ne->ecode, ne->ename);
errorpool = ne->next;
- free(ne);
-
if(pe != NULL)
free(pe);
}
>
> On 11/3/08, Latchesar Ionkov <[EMAIL PROTECTED]> wrote:
> >
> > Acked-by: Latchesar Ionkov <[EMAIL PROTECTED]>
> >
> >
> > On Nov 3, 2008, at 2:36 PM, Abhishek Kulkarni wrote:
> >
> >
> > >
> > > This patch fixes a couple of bugs which prevented xgroupset, xuserset to
> > > skip entries which already existed in the pool.
> > >
> > > xp_nodeerror_print() deletes an error from the errorpool after printing
> > > it.
> > >
> > > Index: utils/xgroupset.c
> > >
> > ===================================================================
> > > --- utils/xgroupset.c (revision 720)
> > > +++ utils/xgroupset.c (working copy)
> > > @@ -141,10 +141,8 @@
> > > if (!strcmp("delete", cmd)) {
> > > if (groupfile) {
> > > setgrent();
> > > - while ((gr = getgrent()) != NULL) {
> > > - if (xp_group_del(nds, adminkey,
> > > gr->gr_name) < 0)
> > > - goto error;
> > > - }
> > > + while ((gr = getgrent()) != NULL)
> > > + xp_group_del(nds, adminkey,
> > > gr->gr_name);
> > > endgrent();
> > > } else {
> > > groupname = argv[optind++];
> > > @@ -154,10 +152,8 @@
> > > } else { /* group add */
> > > if (groupfile) {
> > > setgrent();
> > > - while ((gr = getgrent()) != NULL) {
> > > - if (xp_group_add(nds, adminkey,
> > > gr->gr_name, gr->gr_gid) < 0)
> > > - goto error;
> > > - }
> > > + while ((gr = getgrent()) != NULL)
> > > + xp_group_add(nds, adminkey,
> > > gr->gr_name, gr->gr_gid);
> > > endgrent();
> > > } else {
> > > groupname = argv[optind++];
> > > Index: utils/xuserset.c
> > >
> > ===================================================================
> > > --- utils/xuserset.c (revision 720)
> > > +++ utils/xuserset.c (working copy)
> > > @@ -179,10 +179,8 @@
> > > if (!strcmp("delete", cmd)) {
> > > if (passwdfile) {
> > > setpwent();
> > > - while ((pw = getpwent()) != NULL) {
> > > - if (xp_user_del(nds, adminkey,
> > > pw->pw_name) < 0)
> > > - goto error;
> > > - }
> > > + while ((pw = getpwent()) != NULL)
> > > + xp_user_del(nds, adminkey,
> > > pw->pw_name);
> > > endpwent();
> > > } else {
> > > username = argv[optind++];
> > > @@ -204,9 +202,8 @@
> > > continue;
> > > }
> > >
> > > - if (xp_user_add(nds, adminkey,
> > > pw->pw_name, pw->pw_uid,
> > > - gr->gr_name,
> > > userkey) < 0)
> > > - goto error;
> > > + xp_user_add(nds, adminkey,
> > > pw->pw_name, pw->pw_uid,
> > > + gr->gr_name,
> > > userkey);
> > > }
> > > endpwent();
> > > } else {
> > > Index: libxcpu/node.c
> > >
> > ===================================================================
> > > --- libxcpu/node.c (revision 720)
> > > +++ libxcpu/node.c (working copy)
> > > @@ -167,6 +167,9 @@
> > > for(pe = NULL, ne = errorpool; ne != NULL; pe = ne, ne =
> > > ne->next) {
> > > fprintf(stderr, "%s: %s: Error %d: %s\n",
> > > prog, ne->node->name, ne->ecode, ne->ename);
> > > +
> > > + errorpool = ne->next;
> > > + free(ne);
> > >
> > > if(pe != NULL)
> > > free(pe);
> > >
> > > --
> > > Signed-off-by: Abhishek Kulkarni <[EMAIL PROTECTED]>
> > >
> > >
> >
> >