View | Details | Raw Unified | Return to bug 19536
Collapse All | Expand All

(-)usr.bin/head/head.c (-1 / +14 lines)
Lines 45-50 Link Here
45
  "$FreeBSD: src/usr.bin/head/head.c,v 1.10 1999/08/28 01:01:58 peter Exp $";
45
  "$FreeBSD: src/usr.bin/head/head.c,v 1.10 1999/08/28 01:01:58 peter Exp $";
46
#endif /* not lint */
46
#endif /* not lint */
47
47
48
#include <sys/stat.h>
48
#include <sys/types.h>
49
#include <sys/types.h>
49
50
50
#include <ctype.h>
51
#include <ctype.h>
Lines 73-78 Link Here
73
	char *argv[];
74
	char *argv[];
74
{
75
{
75
	register int ch;
76
	register int ch;
77
	struct stat sb;
76
	FILE *fp;
78
	FILE *fp;
77
	int first, linecnt = -1, bytecnt = -1;
79
	int first, linecnt = -1, bytecnt = -1;
78
	char *ep;
80
	char *ep;
Lines 103-113 Link Here
103
		linecnt = 10;
105
		linecnt = 10;
104
	if (*argv) {
106
	if (*argv) {
105
		for (first = 1; *argv; ++argv) {
107
		for (first = 1; *argv; ++argv) {
106
			if ((fp = fopen(*argv, "r")) == NULL) {
108
			if ((fp = fopen(*argv, "r")) == NULL ||
109
			    fstat(fileno(fp), &sb)) {
107
				warn("%s", *argv);
110
				warn("%s", *argv);
108
				eval = 1;
111
				eval = 1;
109
				continue;
112
				continue;
110
			}
113
			}
114
			if (sb.st_mode & S_IFDIR)
115
				errx(1, "%s is a directory", *argv);
116
			if (sb.st_mode & S_IFLNK)
117
				/* This should transparently be resolved and
118
				 * thus never happen.
119
				 */
120
				errx(1, "%s is a symlink", *argv);
121
			if (sb.st_mode & S_IFWHT)
122
				/* This should never happen. */
123
				errx(1, "%s is a whiteout entry", *argv);
111
			if (argc > 1) {
124
			if (argc > 1) {
112
				(void)printf("%s==> %s <==\n",
125
				(void)printf("%s==> %s <==\n",
113
				    first ? "" : "\n", *argv);
126
				    first ? "" : "\n", *argv);

Return to bug 19536