linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] inotify.7: Merge late perror() into fprintf()
@ 2020-01-20 16:58 Nick Shipp
  2020-01-21 19:46 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Shipp @ 2020-01-20 16:58 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-21 19:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 16:58 [patch] inotify.7: Merge late perror() into fprintf() Nick Shipp
2020-01-21 19:46 ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).