All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Adam Borowski <kilobyte@angband.pl>, linux-man@vger.kernel.org
Cc: mtk.manpages@gmail.com, Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH] open.2: No need for /proc to make an O_TMPFILE file permanent
Date: Fri, 7 Feb 2020 17:31:17 +0100	[thread overview]
Message-ID: <48a55d5f-74bd-e001-ca7f-d7d968960216@gmail.com> (raw)
In-Reply-To: <20180925230929.14449-1-kilobyte@angband.pl>

Hello Adam,

On 9/26/18 1:09 AM, Adam Borowski wrote:
> In the example snippet, we already have the fd, thus there's no
> need to refer to the file by name.  And, /proc/ might be not mounted
> or not accessible.

Thanks! Patch applied.

Cheers,

Michael

> Noticed-by: Theodore Ts'o <tytso@mit.edu>
> Signed-off-by: Adam Borowski <kilobyte@angband.pl>
> ---
>  man2/open.2 | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/man2/open.2 b/man2/open.2
> index 5d0ce66d8..1c775b6b3 100644
> --- a/man2/open.2
> +++ b/man2/open.2
> @@ -811,9 +811,7 @@ fd = open("/path/to/dir", O_TMPFILE | O_RDWR,
>  
>  /* File I/O on 'fd'... */
>  
> -snprintf(path, PATH_MAX,  "/proc/self/fd/%d", fd);
> -linkat(AT_FDCWD, path, AT_FDCWD, "/path/for/file",
> -                        AT_SYMLINK_FOLLOW);
> +linkat(fd, NULL, AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);
>  .EE
>  .in
>  .IP
> 


-- 
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-02-07 16:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180925230929.14449-1-kilobyte@angband.pl>
2020-02-07 16:31 ` Michael Kerrisk (man-pages) [this message]
     [not found] ` <CABpewhFHsm2MaKotzwvmeivviUCXKwP+8ALnKByDRnD990C5Tg@mail.gmail.com>
2020-02-07 16:46   ` [PATCH] open.2: No need for /proc to make an O_TMPFILE file permanent Michael Kerrisk (man-pages)

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=48a55d5f-74bd-e001-ca7f-d7d968960216@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=kilobyte@angband.pl \
    --cc=linux-man@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.