My latest commit broke support for stdin input, whoops.
ok?
Index: file.c
===================================================================
RCS file: /cvs/src/usr.bin/file/file.c,v
retrieving revision 1.62
diff -u -p -u -r1.62 file.c
--- file.c 28 Jun 2017 15:42:49 -0000 1.62
+++ file.c 28 Jun 2017 16:42:40 -0000
@@ -217,12 +217,16 @@ prepare_input(struct input_file *inf, co
{
int fd, mode, error;
+ inf->path = path;
+
if (strcmp(path, "-") == 0) {
if (fstat(STDIN_FILENO, &inf->sb) == -1) {
inf->error = errno;
inf->fd = -1;
+ return;
}
inf->fd = STDIN_FILENO;
+ return;
}
if (Lflag)
@@ -232,6 +236,7 @@ prepare_input(struct input_file *inf, co
if (error == -1) {
inf->error = errno;
inf->fd = -1;
+ return;
}
/* We don't need them, so don't open directories or symlinks. */
@@ -245,7 +250,6 @@ prepare_input(struct input_file *inf, co
if (S_ISLNK(mode))
read_link(inf, path);
inf->fd = fd;
- inf->path = path;
}
static void