Another bug report

Carter Bullard carter at qosient.com
Tue Apr 7 23:32:31 EDT 2009


Hey Dan,
Thanks!!!!!  I will take a look and incorporate into the next upload.

Carter

On Apr 7, 2009, at 5:36 PM, Daniel Klein wrote:

> Umm... oops.  Further testing of my patch found a bug.  Here's the  
> complete patch again, which no longer dumps core when you use %f
>
> -Dan
>
> RCS file: common/RCS/argus_util.c,v
> retrieving revision 1.1
> diff -c -r1.1 common/argus_util.c
> *** common/argus_util.c 2009/04/07 02:27:30     1.1
> --- common/argus_util.c 2009/04/07 21:33:22
> ***************
> *** 15791,15808 ****
>
>     strncpy(timeFormatBuf, parser->RaTimeFormat, 128);
>
> !    while ((ptr = strtok(tstr, "%")) != NULL) {
> !       switch (*ptr) {
>           case 'f': {
> !             if (parser->pflag) {
>                 while (isspace((int)buf[strlen(buf) - 1]))
>                    buf[strlen(buf) - 1] = '\0';
> !                ptr = &buf[strlen(buf)];
> !                sprintf (ptr, "%06u", (int) tvp->tv_usec);
> !                ptr[parser->pflag] = '\0';
>              }
>              break;
>           }
>           case 'z': {
>              if (parser->ArgusPrintXml) {
>                 char sbuf[16];
> --- 16463,16494 ----
>
>     strncpy(timeFormatBuf, parser->RaTimeFormat, 128);
>
> !    for (ptr=tstr; *ptr; ptr++) {
> !       if (*ptr != '%') {
> !        buf[strlen(buf)] = *ptr;
> !       } else
> !       switch (*++ptr) {
>           case 'f': {
> !             if (parser->pflag) {
> !              char *p;
>                 while (isspace((int)buf[strlen(buf) - 1]))
>                    buf[strlen(buf) - 1] = '\0';
> !                p = &buf[strlen(buf)];
> !                sprintf (p, "%06u", (int) tvp->tv_usec);
> !                p[parser->pflag] = '\0';
>              }
>              break;
>           }
> +        case '%': {
> +           buf[strlen(buf)] = '%';
> +           break;
> +        }
> +        case 'E': case 'O': {
> +           char sbuf[8];
> +           sprintf (sbuf, "%%%.2s", ptr++);
> +           strftime (&buf[strlen(buf)], 64, sbuf, tm);
> +           break;
> +        }
>           case 'z': {
>              if (parser->ArgusPrintXml) {
>                 char sbuf[16];
> ***************
> *** 15822,15836 ****
>                 sprintf(&buf[strlen(buf)], "%s", sbuf);
>                 break;
>              }
>           }
>           default: {
>              char sbuf[8];
> !             sprintf (sbuf, "%%%s", ptr);
>              strftime (&buf[strlen(buf)], 64, sbuf, tm);
>              break;
>           }
>        }
> -       tstr = NULL;
>     }
>
>     if (tvp->tv_sec == 0) {
> --- 16508,16522 ----
>                 sprintf(&buf[strlen(buf)], "%s", sbuf);
>                 break;
>              }
> +           /* Fall through to default if %z and not parser- 
> >ArgusPrintXml */
>           }
>           default: {
>              char sbuf[8];
> !             sprintf (sbuf, "%%%c", *ptr);
>              strftime (&buf[strlen(buf)], 64, sbuf, tm);
>              break;
>           }
>        }
>     }
>
>     if (tvp->tv_sec == 0) {
>
>
>




More information about the argus mailing list