Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use FD 6 instead of 3. It's less likely to conflict.

Conflict with what, I'm not sure... also, 6 is a good number.
  • Loading branch information...
commit 354f0b068dcc458357fa4f00d9a4a07bbee39615 1 parent 4d2713d
@falconindy authored
Showing with 6 additions and 4 deletions.
  1. +2 −2 README.pod
  2. +4 −2 init.c
View
4 README.pod
@@ -121,10 +121,10 @@ Hooks are executed during the bootstrap process in order to facilitate finding
and/or mounting of the root device. They run under Busybox's almquist shell.
Because hooks are run as a child process of init, they are unable to directly
export variables affecting their parent. If you need to communicate back with
-init, you may write environment variable declarations on file descriptor 3,
+init, you may write environment variable declarations on file descriptor 6,
which will be picked back up into the environment of init, e.g.
- echo 'root=/dev/foo' >&3
+ echo 'root=/dev/foo' >&6
=head1 BUILDER API
View
6 init.c
@@ -36,6 +36,8 @@
#define CMDLINE_SIZE 257 /* 256 max cmdline len + NULL */
#define TMPFS_FLAGS MS_NOEXEC|MS_NODEV|MS_NOSUID
+#define CHILD_READ_FD 6
+
#define NEWROOT "/new_root"
#define BUSYBOX "/bin/busybox"
#define UDEVD "/sbin/udevd"
@@ -314,8 +316,8 @@ static ssize_t read_child_response(char **argv, char *buffer) { /* {{{ */
if (pid == 0) {
close(pfds[0]); /* unused by child */
- /* child writes on FD 3 will be received by the parent */
- if (dup2(pfds[1], 3) == -1) {
+ /* child writes on CHILD_READ_FD will be received by the parent */
+ if (dup2(pfds[1], CHILD_READ_FD) == -1) {
perror("dup2");
_exit(errno);
}
Please sign in to comment.
Something went wrong with that request. Please try again.