linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pivot_root - wrong check on mount(2)
@ 2020-11-26  0:01 Davide Giorgio
  2020-11-26  9:31 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 6+ messages in thread
From: Davide Giorgio @ 2020-11-26  0:01 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man


[-- Attachment #1.1.1: Type: text/plain, Size: 595 bytes --]

Good morning,

reading the pivot_root man page
(https://man7.org/linux/man-pages/man2/pivot_root.2.html)
there seems to be an error in the example source program
"pivot_root_demo.c".
In particular, there is a wrong check on the return value of mount(2).
https://man7.org/linux/man-pages/man2/mount.2.html#RETURN_VALUE

The error is in this line
if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL) == 1)

that should be
if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL) == -1)


Thank you for your work, kind regards
-- 
Davide Antonino Giorgio
http://giorgiodavide.it

[-- Attachment #1.1.2: 0x4BAA68CE23187566.asc --]
[-- Type: application/pgp-keys, Size: 2505 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2020-11-27  8:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-26  0:01 pivot_root - wrong check on mount(2) Davide Giorgio
2020-11-26  9:31 ` Michael Kerrisk (man-pages)
2020-11-26 12:28   ` Alejandro Colomar (mailing lists; readonly)
2020-11-26 13:40     ` Alejandro Colomar (man-pages)
2020-11-27  8:30     ` Michael Kerrisk (man-pages)
2020-11-27  8:45       ` Alejandro Colomar (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).