linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Nick Shipp <ns@segbrk.com>
Cc: mtk.manpages@gmail.com, linux-man@vger.kernel.org
Subject: Re: [patch] inotify.7: Merge late perror() into fprintf()
Date: Tue, 21 Jan 2020 20:46:09 +0100	[thread overview]
Message-ID: <a2e44f8d-2e91-2fb1-e6f4-9c75f1176196@gmail.com> (raw)
In-Reply-To: <CADjEuPv0ujm9hsvrou2giOeqzZNyKN+vWuHgudvcNNs-ffwCFA@mail.gmail.com>

Hello Nick,

On 1/20/20 5:58 PM, Nick Shipp wrote:
> fprintf may have overridden errno before perror could print it in this
> example.

Thanks. Patch applied.

Cheers,

Michael

> ---
>  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
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

      reply	other threads:[~2020-01-21 19:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2e44f8d-2e91-2fb1-e6f4-9c75f1176196@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=ns@segbrk.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).