Mercurial > illumos > illumos-gate
changeset 13099:baf8bd9f8381
4808318 man -a . tries to format directories
author | Rich Burridge <rich.burridge@oracle.com> |
---|---|
date | Thu, 12 Aug 2010 08:27:14 -0700 |
parents | 1715b7145825 |
children | 2569f04244aa |
files | usr/src/cmd/man/src/man.c |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/man/src/man.c Thu Aug 12 09:27:28 2010 -0400 +++ b/usr/src/cmd/man/src/man.c Thu Aug 12 08:27:14 2010 -0700 @@ -2380,6 +2380,23 @@ perror(manpname); return (-1); } + + /* + * If this is a directory, just ignore it. + */ + if (fstat(fileno(md), &statb) == NULL) { + if (S_ISDIR(statb.st_mode)) { + if (debug) { + (void) fprintf(stderr, + "\tignoring directory %s\n", + manpname); + (void) fflush(stderr); + } + (void) fclose(md); + return (-1); + } + } + if (fgets(manbuf, BUFSIZ-1, md) == NULL) { (void) fclose(md); (void) fprintf(stderr, gettext("%s: null file\n"),