Re: [PATCH] open.2: No need for /proc to make an O_TMPFILE file permanent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
> Signed-off-by: Adam Borowski <kilobyte@xxxxxxxxxx>
> ---
>  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/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux