197873a2610df8024481f5233470e13c6b140d45
chmalee
  Wed Nov 7 15:34:41 2018 -0800
feedback after code review, refs #22414

diff --git src/hg/hgc/barChartClick.c src/hg/hgc/barChartClick.c
index 8052b4b..a022159 100644
--- src/hg/hgc/barChartClick.c
+++ src/hg/hgc/barChartClick.c
@@ -341,37 +341,37 @@
 struct barChartCategory *categ;
 fprintf(f, "%s\t%s\n", "category", "color");
 for (categ = categs; categ != NULL; categ = categ->next)
     {
     //fprintf(f, "%s\t#%06X\n", categ->label, categ->color);
     fprintf(f, "%s\t%d\n", categ->label, categ->color);
     }
 fclose(f);
 return cloneString(colorTn.forCgi);
 }
 
 static void printBoxplot(char *df, char *item, char *name2, char *units, char *colorFile)
 /* Plot data frame to image file and include in HTML */
 {
 struct tempName pngTn;
+struct dyString *cmd = dyStringNew(0);
 trashDirFile(&pngTn, "hgc", "barChart", ".png");
 
 /* Exec R in quiet mode, without reading/saving environment or workspace */
-char cmd[512];
-safef(cmd, sizeof(cmd), "Rscript --vanilla --slave hgcData/barChartBoxplot.R %s '%s' %s %s %s %s",
+dyStringPrintf(cmd, "Rscript --vanilla --slave hgcData/barChartBoxplot.R %s '%s' %s %s %s %s",
                                 item, units, colorFile, df, pngTn.forHtml, isEmpty(name2) ? "n/a" : name2);
-int ret = system(cmd);
+int ret = system(cmd->string);
 if (ret == 0)
     printf("<img src = \"%s\" border=1><br>\n", pngTn.forHtml);
 else
     warn("Error creating boxplot from sample data");
 }
 
 struct asColumn *asFindColByIx(struct asObject *as, int ix)
 /* Find AS column by index */
 {
 struct asColumn *asCol;
 int i;
 for (i=0, asCol = as->columnList; asCol != NULL && i<ix; asCol = asCol->next, i++);
 return asCol;
 }