- arglist_start(argp, fmt);
- while (vsnprintf(pkt->body + len, pkt->packet_size - len, fmt,argp) >=
- (int)(pkt->packet_size - len - 1)) {
+ while(1) {
+ arglist_start(argp, fmt);
+ lenX = g_vsnprintf(pkt->body + len, pkt->packet_size - len, fmt,argp);
+ arglist_end(argp);
+ if (lenX > -1 && lenX < (int)(pkt->packet_size - len - 1))
+ break;