Unverified Commit b15eb500 by Christian Brauner Committed by Stéphane Graber

CODING_STYLE: adapt code example

parent 1478a2fc
...@@ -733,11 +733,11 @@ __do_closedir __attribute__((__cleanup__(__auto_closedir__))) ...@@ -733,11 +733,11 @@ __do_closedir __attribute__((__cleanup__(__auto_closedir__)))
``` ```
For example: For example:
```c ```c
void remount_all_slave(void) void turn_into_dependent_mounts(void)
{ {
__do_free char *line = NULL; __do_free char *line = NULL;
__do_fclose FILE *f = NULL; __do_fclose FILE *f = NULL;
__do_close_prot_errno int memfd = -EBADF, mntinfo_fd = -EBADF; __do_close int memfd = -EBADF, mntinfo_fd = -EBADF;
int ret; int ret;
ssize_t copied; ssize_t copied;
size_t len = 0; size_t len = 0;
...@@ -780,7 +780,7 @@ again: ...@@ -780,7 +780,7 @@ again:
return; return;
} }
f = fdopen(memfd, "r"); f = fdopen(memfd, "re");
if (!f) { if (!f) {
SYSERROR("Failed to open copy of \"/proc/self/mountinfo\" to mark all shared. Continuing"); SYSERROR("Failed to open copy of \"/proc/self/mountinfo\" to mark all shared. Continuing");
return; return;
...@@ -810,12 +810,11 @@ again: ...@@ -810,12 +810,11 @@ again:
null_endofword(target); null_endofword(target);
ret = mount(NULL, target, NULL, MS_SLAVE, NULL); ret = mount(NULL, target, NULL, MS_SLAVE, NULL);
if (ret < 0) { if (ret < 0) {
SYSERROR("Failed to make \"%s\" MS_SLAVE", target); SYSERROR("Failed to recursively turn old root mount tree into dependent mount. Continuing...");
ERROR("Continuing...");
continue; continue;
} }
TRACE("Remounted \"%s\" as MS_SLAVE", target); TRACE("Recursively turned old root mount tree into dependent mount");
} }
TRACE("Remounted all mount table entries as MS_SLAVE"); TRACE("Turned all mount table entries into dependent mount");
} }
``` ```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment