fprintf may have overridden errno before perror could print it in this example. --- man7/inotify.7 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man7/inotify.7 b/man7/inotify.7 index c052acfe6..995a3116f 100644 --- a/man7/inotify.7 +++ b/man7/inotify.7 @@ -1045,8 +1045,8 @@ main(int argc, char* argv[]) wd[i] = inotify_add_watch(fd, argv[i], IN_OPEN | IN_CLOSE); if (wd[i] == \-1) { - fprintf(stderr, "Cannot watch '%s'\en", argv[i]); - perror("inotify_add_watch"); + fprintf(stderr, "Cannot watch '%s': %s\en", + argv[i], strerror(errno)); exit(EXIT_FAILURE); } } -- 2.25.0