On Thu, 2018-12-20 at 14:52 +0300, Dmitry V. Levin wrote:
On Thu, Dec 20, 2018 at 09:02:24AM +0100, Tomas Mraz wrote:
> The attached patch cleans up some issues introduced in pam_motd by
> the
> recent Github pull request. I made the mistake that I did not build
> it
> before merging and I did not catch these issues in the review.
>
> In particular it fixes warnings about int signedness, about losing
> const qualifier and unused function.
>
> It also silences syslog error reporting if in the default
> configuration
> the motd directories are missing. I keep the error log in case the
> configuration is non-default or the error is something else than
> ENOENT.
>
> OK to commit?
Thanks, it looks good although I haven't tried to compile it, too.
Just two minor issues you can try to address while committing:
> @@ -226,17 +205,20 @@ static void
> try_to_display_directories_with_overrides(pam_handle_t *pamh,
> pam_syslog(pamh, LOG_CRIT, "pam_motd: failed to allocate
> dirent arrays");
> goto out;
> }
> - if ((dirscans_sizes = (int *)calloc(num_motd_dirs,
> sizeof(int))) == NULL) {
> + if ((dirscans_sizes = (unsigned int *)calloc(num_motd_dirs,
> sizeof(int))) == NULL) {
I don't think any cast of calloc return value is needed.
Yes, sure, I'll remove it. There are also three other occurrences which
I'll cleanup as well.
> pam_syslog(pamh, LOG_CRIT, "pam_motd: failed to allocate
> dirent array sizes");
> goto out;
> }
>
> for (i = 0; i < num_motd_dirs; i++) {
> - dirscans_sizes[i] = scandir(motd_dir_path_split[i],
> &(dirscans[i]),
> + int rv;
> + rv = scandir(motd_dir_path_split[i], &(dirscans[i]),
> filter_dirents, alphasort);
> - if (dirscans_sizes[i] < 0) {
> - pam_syslog(pamh, LOG_ERR, "pam_motd: error scanning
> directory %s", motd_dir_path_split[i]);
> - dirscans_sizes[i] = 0;
> + if (rv < 0) {
> + if (errno != ENOENT || report_missing) {
> + pam_syslog(pamh, LOG_ERR, "pam_motd: error
> scanning directory %s: %m", motd_dir_path_split[i]);
This line was too long before the change, could you wrap it, please?
OK
_______________________________________________
Pam-developers mailing list -- pam-developers(a)lists.fedorahosted.org
To unsubscribe send an email to pam-developers-leave(a)lists.fedorahost
ed.org
Fedora Code of Conduct:
https://getfedora.org/code-of-conduct.html
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelin
es
List Archives:
https://lists.fedorahosted.org/archives/list/pam-devel
opers(a)lists.fedorahosted.org
--
Tomáš Mráz
No matter how far down the wrong road you've gone, turn back.
Turkish proverb
[You'll know whether the road is wrong if you carefully listen to your
conscience.]