git: 8e857d9812fa - stable/14 - examples/inotify: Handle a zero-length name

Mark Johnston <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a7353d2.45059.3481d1d8__11092.338110187$1785943171$gmane$org@gitrepo.freebsd.org>
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=8e857d9812fa5dc02765d6f0e095269ced84cdf8

commit 8e857d9812fa5dc02765d6f0e095269ced84cdf8
Author:     Mark Johnston <[email protected]>
AuthorDate: 2025-07-07 13:51:41 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-08-05 15:15:15 +0000

    examples/inotify: Handle a zero-length name
    
    Reported by:    jlduran
    Fixes:          1d8664d69041 ("examples: Add a demo program for inotify")
    
    (cherry picked from commit 97452b097a4a35df8ce8cbd44786fb7d95db2a92)
---
 share/examples/inotify/inotify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/examples/inotify/inotify.c b/share/examples/inotify/inotify.c
index b8e300bc992c..ea63ccd1f337 100644
--- a/share/examples/inotify/inotify.c
+++ b/share/examples/inotify/inotify.c
@@ -154,7 +154,7 @@ main(int argc, char **argv)
 			ev = ev2str(iev1->mask);
 			xo_open_instance("event");
 			xo_emit("{:wd/%3d} {:event/%16s} {:name/%s}\n",
-			    iev1->wd, ev, iev1->name);
+			    iev1->wd, ev, iev1->len > 0 ? iev1->name : "");
 			xo_close_instance("event");
 
 			n -= sizeof(*iev1) + iev1->len;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.