Support NOTE_TRUNCATE to allow entr to trigger on truncated files.

OK with Eric Radman (port maintainer/upstream).
This commit is contained in:
sthen 2014-04-05 22:14:59 +00:00
parent aeab687fd4
commit c1df977514
2 changed files with 24 additions and 1 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.6 2014/03/20 11:17:09 sthen Exp $
# $OpenBSD: Makefile,v 1.7 2014/04/05 22:14:59 sthen Exp $
COMMENT = run arbitrary commands when files change
DISTNAME = entr-2.8
REVISION = 0
REV = 9192ece7198c
CATEGORIES = sysutils

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-entr_c,v 1.1 2014/04/05 22:14:59 sthen Exp $
--- entr.c.orig Thu Mar 13 18:44:39 2014
+++ entr.c Sat Apr 5 10:32:08 2014
@@ -38,7 +38,7 @@
/* events to watch for */
-#define NOTE_ALL NOTE_DELETE|NOTE_WRITE|NOTE_EXTEND|NOTE_RENAME
+#define NOTE_ALL NOTE_DELETE|NOTE_WRITE|NOTE_EXTEND|NOTE_RENAME|NOTE_TRUNCATE
/* shortcuts */
@@ -456,7 +456,8 @@ main:
if (evList[i].fflags & NOTE_DELETE ||
evList[i].fflags & NOTE_WRITE ||
evList[i].fflags & NOTE_EXTEND ||
- evList[i].fflags & NOTE_RENAME) {
+ evList[i].fflags & NOTE_RENAME ||
+ evList[i].fflags & NOTE_TRUNCATE) {
if (fifo.fd == 0)
do_exec = 1;
else {