david wrote:
> Ken wrote:
>
> > maybe the "right" fix is to properly bubble up read errors from m_getfld()?
>
> I agree, and would be willing to visit that after 1.7. I think
> that all callers should be able to handle the error, but I'm not certain.
>
> In the meantime, how about the fix below to parse_mime()? That
> should be done in any case, because parse_mime() really expects a file.
the patch looks fine to me, though the comment could be modified a
bit, or moved. do you need me to test it?
paul
>
> David
>
> index 5db4efe..bd2b16c 100644
> --- a/uip/mhparse.c
> +++ b/uip/mhparse.c
> @@ -211,0 +212 @@ parse_mime (char *file)
> + struct stat statbuf;
> @@ -247,3 +248,12 @@ parse_mime (char *file)
> - } else if ((fp = fopen (file, "r")) == NULL) {
> - advise (file, "unable to read");
> - return NULL;
> + } else {
> + /* Don't try to parse a directory. */
> + if (lstat (file, &statbuf) == NOTOK) {
> + advise (file, "unable to lstat");
> + return NULL;
> + } else if (S_ISDIR(statbuf.st_mode)) {
> + advise (NULL, "%s is a directory", file);
> + return NULL;
> + } else if ((fp = fopen (file, "r")) == NULL) {
> + advise (file, "unable to read");
> + return NULL;
> + }
>
> _______________________________________________
> Nmh-workers mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/nmh-workers
>
=----------------------
paul fox, [email protected] (arlington, ma, where it's 39.4 degrees)
_______________________________________________
Nmh-workers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/nmh-workers