All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] open.2: Fix bug in linkat(2) call example
@ 2021-02-26 20:11 Alejandro Colomar
  0 siblings, 0 replies; 3+ messages in thread
From: Alejandro Colomar @ 2021-02-26 20:11 UTC (permalink / raw)
  To: mtk.manpages
  Cc: Alejandro Colomar, linux-man, Walter Harms, Theodore Ts'o,
	Adam Borowski

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>
---
 man2/open.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man2/open.2 b/man2/open.2
index 03fff1b65..267e79656 100644
--- a/man2/open.2
+++ b/man2/open.2
@@ -823,7 +823,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)),
-- 
2.30.1.721.g45526154a5


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] fflush.3: SEE ALSO: Add fpurge(3)
@ 2021-05-09 21:38 Alejandro Colomar
  2021-05-09 21:39 ` [PATCH] open.2: Fix bug in linkat(2) call example Alejandro Colomar
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar @ 2021-05-09 21:38 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man

fpurge(i_stream) does the same as fflush(i_stream), AFAIK.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---

Hi Michael,

This is the first of many separate patches that I had pending for you.
Some of them I already sent you, and you should ignore the old versions.
Some of them are new.
Please review them thoroughly, as I may have sent some patch that wasn't
ready.  In theory I have reviewed them enough, but there are a lot, and
I might have overlooked something.


When you review this "set", I'll send you another one about the SYNOPSIS.


Thanks,

Alex


 man3/fflush.3 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/man3/fflush.3 b/man3/fflush.3
index 138c9bcfe..a600da2ae 100644
--- a/man3/fflush.3
+++ b/man3/fflush.3
@@ -133,6 +133,7 @@ or
 .BR sync (2),
 .BR write (2),
 .BR fclose (3),
+.BR fpurge (3),
 .BR fileno (3),
 .BR fopen (3),
 .BR setbuf (3),
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-10  0:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26 20:11 [PATCH] open.2: Fix bug in linkat(2) call example Alejandro Colomar
2021-05-09 21:38 [PATCH] fflush.3: SEE ALSO: Add fpurge(3) Alejandro Colomar
2021-05-09 21:39 ` [PATCH] open.2: Fix bug in linkat(2) call example Alejandro Colomar
2021-05-10  0:50   ` Michael Kerrisk (man-pages)

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.