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

Function cupsdCreateConfFile

scheduler/file.c:178–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176 */
177
178cups_file_t * /* O - File pointer */
179cupsdCreateConfFile(
180 const char *filename, /* I - Filename */
181 mode_t mode) /* I - Permissions */
182{
183 cups_file_t *fp; /* File pointer */
184 char newfile[1024]; /* filename.N */
185
186
187 snprintf(newfile, sizeof(newfile), "%s.N", filename);
188 if ((fp = cupsFileOpen(newfile, "w")) == NULL)
189 {
190 cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create \"%s\": %s", newfile,
191 strerror(errno));
192 }
193 else
194 {
195 if (!getuid() && fchown(cupsFileNumber(fp), getuid(), Group))
196 cupsdLogMessage(CUPSD_LOG_WARN, "Unable to change group for \"%s\": %s",
197 newfile, strerror(errno));
198
199 if (fchmod(cupsFileNumber(fp), mode))
200 cupsdLogMessage(CUPSD_LOG_WARN,
201 "Unable to change permissions for \"%s\": %s",
202 newfile, strerror(errno));
203 }
204
205 return (fp);
206}
207
208
209/*

Callers 10

install_cupsd_confFunction · 0.85
copy_fileFunction · 0.85
copy_modelFunction · 0.85
create_local_bg_threadFunction · 0.85
cupsdSaveAllJobsFunction · 0.85
cupsdSaveJobFunction · 0.85
cupsdSaveAllClassesFunction · 0.85
cupsdSaveAllPrintersFunction · 0.85
cupsdUpdatePrinterPPDFunction · 0.85

Calls 3

cupsFileOpenFunction · 0.85
cupsdLogMessageFunction · 0.85
cupsFileNumberFunction · 0.85

Tested by

no test coverage detected