]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Save/restore line number to fix error line reporting.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 17 Oct 2018 20:36:35 +0000 (16:36 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 17 Oct 2018 20:37:04 +0000 (16:37 -0400)
test/ipptool.c

index 1e59fa96e92448572d619099a3b93ccca799c47f..cf919b3034863359f52660f46bf0b2b0580cbdee 100644 (file)
@@ -3786,6 +3786,7 @@ token_cb(_ipp_file_t      *f,             /* I - IPP file data */
             !_cups_strcasecmp(token, "WITH-VALUE"))
     {
       off_t    lastpos;                /* Last file position */
+      int      lastline;               /* Last line number */
 
       if (data->last_expect)
       {
@@ -3815,8 +3816,9 @@ token_cb(_ipp_file_t      *f,             /* I - IPP file data */
 
       for (;;)
       {
-        lastpos = cupsFileTell(f->fp);
-        ptr     += strlen(ptr);
+        lastpos  = cupsFileTell(f->fp);
+        lastline = f->linenum;
+        ptr      += strlen(ptr);
 
        if (!_ippFileReadToken(f, ptr, (sizeof(temp) - (size_t)(ptr - temp))))
          break;
@@ -3839,6 +3841,7 @@ token_cb(_ipp_file_t      *f,             /* I - IPP file data */
           */
 
           cupsFileSeek(f->fp, lastpos);
+          f->linenum = lastline;
           *ptr = '\0';
           break;
        }