dece7b9ed5de8344f90c9ce8e85871ecc4264405 braney Thu Aug 25 16:56:03 2011 -0700 don't save the newlines at the end of error messages in the hubStatus table diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c index 790d814..1673481 100644 --- src/hg/lib/hubConnect.c +++ src/hg/lib/hubConnect.c @@ -547,31 +547,39 @@ * the cart variable the references this hub */ { /* clear the hubStatus table */ unsigned id = hubClearStatus(url); /* remove the cart variable */ char buffer[1024]; safef(buffer, sizeof buffer, "hgHubConnect.hub.%d", id); cartRemove(cart, buffer); } void hubSetErrorMessage(char *errorMessage, unsigned id) /* set the error message in the hubStatus table */ { struct sqlConnection *conn = hConnectCentral(); -char query[256]; +char query[4096]; + if (errorMessage != NULL) { + // make sure there is no newline at the end. This should be unneccesary + // but there are many, many places where newlines are added in calls + // to warn and errAbort + char buffer[4096]; + strcpy(buffer, errorMessage); + while (lastChar(buffer) == '\n') + buffer[strlen(buffer) - 1] = '\0'; safef(query, sizeof(query), "update %s set errorMessage=\"%s\", lastNotOkTime=now() where id=%d", - hubStatusTableName, errorMessage, id); + hubStatusTableName, buffer, id); } else { safef(query, sizeof(query), "update %s set errorMessage=\"\", lastOkTime=now() where id=%d", hubStatusTableName, id); } sqlUpdate(conn, query); hDisconnectCentral(&conn); }