-
Notifications
You must be signed in to change notification settings - Fork 464
-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cupsFileTell() returns invalid results for append mode (log files) #2810
Comments
CUPS.org User: mike Fixed in Subversion repository. |
"str2810.patch": Index: file.c--- file.c (revision 7489)
bytes = (ssize_t)(fp->ptr - fp->buf);
if (!fp || (fp->mode != 'r' && fp->mode != 's')) DEBUG_printf(("cupsFileGetChar: Returning %d...\n", *(fp->ptr) & 255));
return (*(fp->ptr)++ & 255); @@ -500,6 +508,10 @@
@@ -654,6 +669,7 @@
if (ch == '\r')
return (ptr - buf); @@ -706,6 +727,9 @@
@@ -725,6 +749,7 @@
if (ch == '\r')
return (buf); @@ -811,8 +841,9 @@
if ((fp->ptr + bytes) > fp->end) fp->pos += bytes;
if (bytes > sizeof(fp->buf)) fp->pos ++;
return (0); @@ -1202,6 +1251,8 @@
return (bytes); @@ -1211,6 +1262,8 @@ fp->pos += bytes;
if (bytes > sizeof(fp->buf))
/*
return ((ssize_t)total);
if (!fp || fp->mode != 'r') @@ -1322,18 +1382,22 @@
if (fp->ptr)
return (0); @@ -1351,11 +1415,14 @@ lseek(fp->fd, 0, SEEK_SET);
return (0); @@ -1373,9 +1440,10 @@
/*
#ifdef HAVE_LIBZ /*
- bytes = 0;fp->eof = 0;
#ifdef HAVE_LIBZ
#ifdef HAVE_LIBZ
- }return (fp->pos); @@ -1628,6 +1691,9 @@
return (fp ? fp->pos : 0); @@ -1645,6 +1711,8 @@
if (!fp || fp->mode == 's') @@ -1675,6 +1743,9 @@
@@ -1692,6 +1763,8 @@
return ((ssize_t)bytes); @@ -1701,6 +1774,8 @@ fp->pos += (off_t)bytes;
if (bytes > sizeof(fp->buf))
- */if (fp->ptr && fp->end)
#ifdef HAVE_LIBZ
while (!fp->ptr || fp->compressed)
if (total >= 0) @@ -2159,8 +2235,8 @@
if (count < 0) - DEBUG_printf((" count=%ld\n", (long)count));
|
Version: 1.3-current
CUPS.org User: mike
cupsFileTell() returns for the current file position when appending to an existing file. It should return the current file size.
This is most noticeable with the log file rotation in the scheduler - if the scheduler is restarted (very common on Mac OS X since launchd runs cupsd on demand), we lose track of the log file size and do not rotate the old access_log or error_log files.
The text was updated successfully, but these errors were encountered: