31c31
< __FBSDID("$FreeBSD: head/usr.bin/grep/file.c 210389 2010-07-22 19:11:57Z gabor $");
---
> __FBSDID("$FreeBSD: head/usr.bin/grep/file.c 211364 2010-08-15 22:15:04Z gabor $");
70c70
< int
---
> static inline int
77c77
< return (fgetc(f->f));
---
> return (getc_unlocked(f->f));
95c95
< int
---
> static inline int
101c101
< return (feof(f->f));
---
> return (feof_unlocked(f->f));
133a134,136
> /* no need to allocate buffer. */
> if (st.st_size == 0)
> return (NULL);
144a148,149
> if ((ch == '\n') && lbflag)
> break;
186a192,194
> /* Processing stdin implies --line-buffered for tail -f to work. */
> lbflag = true;
>
190a199
> binbuf = NULL;
191a201
> flockfile(f->f);
211a222
> binbuf = NULL;
215c226,227
< if ((f->f = fopen(path, "r")) != NULL)
---
> if ((f->f = fopen(path, "r")) != NULL) {
> flockfile(f->f);
216a229
> }
240a254
> funlockfile(f->f);
254d267
<
< __FBSDID("$FreeBSD: head/usr.bin/grep/file.c 210389 2010-07-22 19:11:57Z gabor $");
---
> __FBSDID("$FreeBSD: head/usr.bin/grep/file.c 211364 2010-08-15 22:15:04Z gabor $");
70c70
< int
---
> static inline int
77c77
< return (fgetc(f->f));
---
> return (getc_unlocked(f->f));
95c95
< int
---
> static inline int
101c101
< return (feof(f->f));
---
> return (feof_unlocked(f->f));
133a134,136
> /* no need to allocate buffer. */
> if (st.st_size == 0)
> return (NULL);
144a148,149
> if ((ch == '\n') && lbflag)
> break;
186a192,194
> /* Processing stdin implies --line-buffered for tail -f to work. */
> lbflag = true;
>
190a199
> binbuf = NULL;
191a201
> flockfile(f->f);
211a222
> binbuf = NULL;
215c226,227
< if ((f->f = fopen(path, "r")) != NULL)
---
> if ((f->f = fopen(path, "r")) != NULL) {
> flockfile(f->f);
216a229
> }
240a254
> funlockfile(f->f);
254d267
<