public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Guillem Jover <guillem-+FW4gsLVM0RAfugRpC6u6w@public.gmane.org>
To: Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] readlink.2: Document using st_size to allocate the buffer
Date: Sun, 25 Sep 2011 06:05:35 +0200	[thread overview]
Message-ID: <20110925040535.GA10073@gaara.hadrons.org> (raw)
In-Reply-To: <CAKgNAkj0FjVtJrJgaifSQ-xy+4GQm3GNmjoOndxMfGeXa+titQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi!

On Tue, 2011-09-20 at 08:51:41 +0200, Michael Kerrisk wrote:
> I made some edits to your patch, and placed the added explanatory text
> in NOTES, rather than DESCRIPTION. Modified patch below.
> 
> The change will be in 3.34.

Thanks! Looks good.

> diff --git a/man2/readlink.2 b/man2/readlink.2
> index c9f6d92..051a870 100644
> --- a/man2/readlink.2
> +++ b/man2/readlink.2
> @@ -1,4 +1,5 @@
>  .\" Copyright (c) 1983, 1991 The Regents of the University of California.
> +.\" Adn Copyright (C) 2011 Guillem Jover <guillem-+FW4gsLVM0RAfugRpC6u6w@public.gmane.org>

Small typo: Adn → And.

> +    r = readlink(argv[1], linkname, sb.st_size + 1);
> +
> +    if (r < 0) {
> +        perror("lstat");
> +        exit(EXIT_FAILURE);
> +    }
> +
> +    if (r != sb.st_size) {
> +        fprintf(stderr, "symlink increased in size "
> +                        "between lstat() and readlink()\\n");
> +        exit(EXIT_FAILURE);
> +    }

You might want to change the check condition to “r > sb.st_size” to
match the new error string.

thanks,
guillem
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-09-25  4:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21  3:19 [PATCH] readlink.2: Document using st_size to allocate the buffer Guillem Jover
     [not found] ` <20110421031957.GA12346-v62vTE6/wQGgM1MOaoewpti2O/JbrIOy@public.gmane.org>
2011-09-20  6:51   ` Michael Kerrisk
     [not found]     ` <CAKgNAkj0FjVtJrJgaifSQ-xy+4GQm3GNmjoOndxMfGeXa+titQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-25  4:05       ` Guillem Jover [this message]
     [not found]         ` <20110925040535.GA10073-v62vTE6/wQGgM1MOaoewpti2O/JbrIOy@public.gmane.org>
2011-09-25  4:55           ` Michael Kerrisk

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=20110925040535.GA10073@gaara.hadrons.org \
    --to=guillem-+fw4gslvm0rafugrpc6u6w@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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