MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsdCheckLogFile

Function cupsdCheckLogFile

scheduler/log.c:109–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107 */
108
109int /* O - 1 if log file open */
110cupsdCheckLogFile(cups_file_t **lf, /* IO - Log file */
111 const char *logname) /* I - Log filename */
112{
113 char backname[1024], /* Backup log filename */
114 filename[1024], /* Formatted log filename */
115 *ptr; /* Pointer into filename */
116 const char *logptr; /* Pointer into log filename */
117
118
119 /*
120 * See if we have a log file to check...
121 */
122
123 if (!lf || !logname || !logname[0])
124 return (1);
125
126 /*
127 * Handle logging to stderr...
128 */
129
130 if (!strcmp(logname, "stderr"))
131 {
132 *lf = LogStderr;
133 return (1);
134 }
135
136 /*
137 * Format the filename as needed...
138 */
139
140 if (!*lf ||
141 (strncmp(logname, "/dev/", 5) && cupsFileTell(*lf) > MaxLogSize &&
142 MaxLogSize > 0))
143 {
144 /*
145 * Handle format strings...
146 */
147
148 filename[sizeof(filename) - 1] = '\0';
149
150 if (logname[0] != '/')
151 {
152 strlcpy(filename, ServerRoot, sizeof(filename));
153 strlcat(filename, "/", sizeof(filename));
154 }
155 else
156 {
157 filename[0] = '\0';
158 }
159
160 for (logptr = logname, ptr = filename + strlen(filename); *logptr && ptr < (filename + sizeof(filename) - 1); logptr ++)
161 {
162 if (*logptr == '%')
163 {
164 /*
165 * Format spec...
166 */

Callers 3

cupsdLogPageFunction · 0.85
cupsdLogRequestFunction · 0.85
cupsdWriteErrorLogFunction · 0.85

Calls 6

cupsFileTellFunction · 0.85
cupsFileOpenFunction · 0.85
cupsdCheckPermissionsFunction · 0.85
cupsdEndProcessFunction · 0.85
cupsFileNumberFunction · 0.85
cupsFileCloseFunction · 0.85

Tested by

no test coverage detected