=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/file/file.c,v retrieving revision 1.62 retrieving revision 1.63 diff -c -r1.62 -r1.63 *** src/usr.bin/file/file.c 2017/06/28 15:42:49 1.62 --- src/usr.bin/file/file.c 2017/06/28 17:14:15 1.63 *************** *** 1,4 **** ! /* $OpenBSD: file.c,v 1.62 2017/06/28 15:42:49 deraadt Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: file.c,v 1.63 2017/06/28 17:14:15 brynet Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott *************** *** 217,228 **** --- 217,232 ---- { 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,237 **** --- 236,242 ---- if (error == -1) { inf->error = errno; inf->fd = -1; + return; } /* We don't need them, so don't open directories or symlinks. */ *************** *** 245,251 **** if (S_ISLNK(mode)) read_link(inf, path); inf->fd = fd; - inf->path = path; } static void --- 250,255 ----