Skip to content

Comments

scheduler/conf.c: Print to stderr if we don't open cups-files.conf#777

Merged
zdohnal merged 1 commit intoOpenPrinting:masterfrom
zdohnal:readcupsfiles_stderr
Sep 4, 2023
Merged

scheduler/conf.c: Print to stderr if we don't open cups-files.conf#777
zdohnal merged 1 commit intoOpenPrinting:masterfrom
zdohnal:readcupsfiles_stderr

Conversation

@zdohnal
Copy link
Member

@zdohnal zdohnal commented Aug 23, 2023

In case cupsd can't open the cups-files.conf, the error message is lost if journal and syslog don't exist or work on system (usually in containers).

Log the error into stderr at this place to get the error message if needed.

Copy link
Member

@michaelrsweet michaelrsweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to change this, we might as well include the error message (strerror).

@zdohnal zdohnal force-pushed the readcupsfiles_stderr branch from 93e9991 to 4866876 Compare August 29, 2023 14:17
@zdohnal
Copy link
Member Author

zdohnal commented Aug 29, 2023

Updated.

Copy link
Member

@michaelrsweet michaelrsweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor tweak needed, then good to go.

scheduler/conf.c Outdated
#else
syslog(LOG_LPR, "Unable to open \"%s\" - %s", CupsFilesFile, strerror(errno));
#endif /* HAVE_SYSTEMD_SD_JOURNAL_H */
fprintf(stderr, "Unable to read \"%s\" - \"%s\".\n", CupsFilesFile, strerror(errno));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for quotes around the error message, nor the trailing period (since the error message usually has that). Otherwise OK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

In case cupsd can't open the cups-files.conf, the error message is lost
if journal and syslog don't exist or work on system (usually in
containers).

Log the error into stderr at this place to get the error message if
needed.
@zdohnal zdohnal force-pushed the readcupsfiles_stderr branch from 1e6a89b to db9cecd Compare September 1, 2023 15:11
Copy link
Member

@michaelrsweet michaelrsweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@zdohnal zdohnal merged commit b7a60b8 into OpenPrinting:master Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants