annotate sources/patches/toybox-oneit.patch @ 1782:6f23a328bc48 draft

Glitch in oneit that hit uClibc's pipe() error checking on sparc. (Not that I'm sure that uClibc check is right either, but...)
author Rob Landley <rob@landley.net>
date Sat, 05 Sep 2015 14:26:17 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1782
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 commit 9592214cc5670605544a083d67ff916c9a802b13
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 Author: Rob Landley <rob@landley.net>
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 Date: Sat Sep 5 14:14:09 2015 -0500
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 Large thinko, -3 was always enabled in optflags. (Oops.)
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 diff --git a/toys/other/oneit.c b/toys/other/oneit.c
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
8 index 8e4b713..a3fe024 100644
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 --- a/toys/other/oneit.c
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
10 +++ b/toys/other/oneit.c
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 @@ -61,7 +61,7 @@ void oneit_main(void)
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 {
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 int i, pid, pipes[] = {SIGUSR1, SIGUSR2, SIGTERM, SIGINT};
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
14
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 - if (FLAG_3) {
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 + if (toys.optflags & FLAG_3) {
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 // Ensure next available filehandle is #3
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 while (open("/", 0) < 3);
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 close(3);
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 @@ -83,7 +83,7 @@ void oneit_main(void)
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 // We ignore the return value of write (what would we do with it?)
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 // but save it in a variable we never read to make fortify shut up.
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 // (Real problem is if pid2 never reads, write() fills pipe and blocks.)
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 - while (pid != wait(&i)) if (FLAG_3) i = write(4, &pid, 4);
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 + while (pid != wait(&i)) if (toys.optflags & FLAG_3) i = write(4, &pid, 4);
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
26 if (toys.optflags & FLAG_n) continue;
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
27
6f23a328bc48 Glitch in oneit that hit uClibc's pipe() error checking on sparc.
Rob Landley <rob@landley.net>
parents:
diff changeset
28 oneit_signaled((toys.optflags & FLAG_p) ? SIGUSR2 : SIGTERM);