[torqueusers] Bug in lib/Libcmds/set_attr.c

Michael Musson musson at clusterresources.com
Thu Jul 28 11:53:02 MDT 2005


Prakash,

Thanks for the bug report.  It has been fixed and is in the latest
snapshot release.

Best,

Mike M.


On Thu, 2005-07-28 at 12:52 -0400, Prakash Velayutham wrote:
> Hi,
> 
> There is a (rather trivial) bug in the lib/Libcmds/set_attr.c file. I am 
> attaching the source below with the bug underlined. The variable should 
> be attr->value but it is attr->name. Could someone get this corrected in 
> the CVS.
> 
> #include <pbs_config.h>   /* the master config generated by configure */
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> #include "pbs_ifl.h"
> 
> void set_attr(
>   struct attrl **attrib,
>   char *attrib_name,
>   char *attrib_value)
>   {
>   struct attrl *attr, *ap;
>   attr = (struct attrl *) malloc(sizeof(struct attrl));
>   if (attr == NULL)
>     {
>     fprintf(stderr, "Out of memory\n");
>     exit(2);
>     }
>   if (attrib_name == NULL)
>     {
>     attr->name = NULL;
>     }
>   else
>     {
>     attr->name = (char *)malloc(strlen(attrib_name) + 1);
>     if (attr->name == NULL)
>       {
>       fprintf(stderr, "Out of memory\n");
>       exit(2);
>       }
>     strcpy(attr->name,attrib_name);
>     }
>   attr->resource = NULL;
>   if (attrib_value == NULL)
>     {
>     attr->value = NULL;
>     }
>   else
>     {
>     attr->value = (char *)malloc(strlen(attrib_value) + 1);
>     if (*_attr->name_* == NULL)
>       {
>       fprintf(stderr, "Out of memory\n");
>       exit(2);
>       }
>     strcpy(attr->value,attrib_value);
>     }
>   attr->next = NULL;
>   if (*attrib == NULL)
>     {
>     *attrib = attr;
>     }
>   else
>     {
>     ap = *attrib;
>     while (ap->next != NULL)
>       ap = ap->next;
>     ap->next = attr;
>     }
>   return;
>   }  /* END set_attr() */
> 
> Regards,
> Prakash
> _______________________________________________
> torqueusers mailing list
> torqueusers at supercluster.org
> http://www.supercluster.org/mailman/listinfo/torqueusers



More information about the torqueusers mailing list