]> git.ipfire.org Git - thirdparty/man-pages.git/commit
open.2: Fix bug in linkat(2) call example
authorAlejandro Colomar <alx.manpages@gmail.com>
Sun, 9 May 2021 21:39:00 +0000 (23:39 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 10 May 2021 16:34:03 +0000 (04:34 +1200)
commit1c5519574314a8109cd23d8efc821d2813b46d33
tree8e98da08702ee5b59e366eb810744c5d79b5c1f8
parent3eb81f51170bac035b7a13663d7aeef785c584f1
open.2: Fix bug in linkat(2) call example

AT_EMPTY_PATH works with empty strings (""), but not with NULL
(or at least it's not obvious).

The relevant kernel code is the following:

linux$ sed -n 189,198p fs/namei.c
result->refcnt = 1;
/* The empty path is special. */
if (unlikely(!len)) {
if (empty)
*empty = 1;
if (!(flags & LOOKUP_EMPTY)) {
putname(result);
return ERR_PTR(-ENOENT);
}
}

Reported-by: Walter Harms <wharms@bfs.de>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man2/open.2