Hi ALex, On 5/10/21 9:39 AM, Alejandro Colomar wrote: > 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@xxxxxx> > Cc: Theodore Ts'o <tytso@xxxxxxx> > Cc: Adam Borowski <kilobyte@xxxxxxxxxx> > Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx> Thanks. Patch applied. Cheers, Michael > --- > man2/open.2 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/man2/open.2 b/man2/open.2 > index 6360636af..bac1ee806 100644 > --- a/man2/open.2 > +++ b/man2/open.2 > @@ -824,7 +824,7 @@ fd = open("/path/to/dir", O_TMPFILE | O_RDWR, > > /* File I/O on \(aqfd\(aq... */ > > -linkat(fd, NULL, AT_FDCWD, "/path/for/file", AT_EMPTY_PATH); > +linkat(fd, "", AT_FDCWD, "/path/for/file", AT_EMPTY_PATH); > > /* If the caller doesn\(aqt have the CAP_DAC_READ_SEARCH > capability (needed to use AT_EMPTY_PATH with linkat(2)), > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/