├── .gitignore
├── autogen.sh
├── Makefile.am
├── template
├── configure.ac
├── findstatic.pl
├── src
├── filedesc.c
└── main.c
├── coding-style.txt
└── COPYING.Apache-2.0
/.gitignore:
--------------------------------------------------------------------------------
1 | *.cache
2 | *.log
3 | *.o
4 |
--------------------------------------------------------------------------------
/autogen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | autoreconf --force --install --symlink --warnings=all
6 |
7 | args="\
8 | --sysconfdir=/etc \
9 | --localstatedir=/var \
10 | --prefix=/usr \
11 | --enable-silent-rules"
12 |
13 | ./configure CFLAGS="-g -O1 $CFLAGS" $args "$@"
14 | make clean
15 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | EXTRA_DIST = COPYING.Apache-2.0 findstatic.pl
2 |
3 | AM_CFLAGS = -g -Wall -W -Wformat-security -D_FORTIFY_SOURCE=2 -fno-common
4 |
5 | bin_PROGRAMS = \
6 | java
7 |
8 | java_SOURCES = \
9 | src/main.c \
10 | src/filedesc.c
11 |
12 | distclean-local:
13 | rm -rf aclocal.m4 ar-lib autom4te.cache config.guess config.h.in config.h.in~ config.sub configure depcomp install-sh ltmain.sh m4 Makefile.in missing compile
14 |
15 |
16 | install-exec-hook:
17 | perl ${top_srcdir}/findstatic.pl ${top_builddir}/src/*.o | grep -v Checking ||:
18 |
19 |
--------------------------------------------------------------------------------
/template:
--------------------------------------------------------------------------------
1 | /*
2 | * usrbinjava -- java wrapper
3 | *
4 | * Copyright (C) 2015 Intel Corporation.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, version 3, with OpenSSL-exception.
9 | *
10 | * Alternatively, you can chose to redistribute and/or modifiy this
11 | * software under the terms of the Apache-2.0 license as published
12 | * by the Apache Software Foundation.
13 | *
14 | * If you want to contribute code to this project using only one,
15 | * instead of both, of these licenses, you need to remove the other
16 | * license text from this file as part of your contribution.
17 | *
18 | * This program is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU General Public License for more details.
22 | *
23 | * You should have received a copy of the GNU General Public License
24 | * along with this program. If not, see .
25 | * Likewise, you should have received a copy of the Apache-2.0 license,
26 | * which can also be found at http://www.apache.org/licenses/LICENSE-2.0
27 | *
28 | * Authors:
29 | * Arjan van de Ven
30 | *
31 | */
32 |
33 | #define _GNU_SOURCE
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 |
40 |
--------------------------------------------------------------------------------
/configure.ac:
--------------------------------------------------------------------------------
1 | # -*- Autoconf -*-
2 | # Process this file with autoconf to produce a configure script.
3 |
4 | AC_PREREQ([2.66])
5 | AC_INIT(usrbinjava, 2, dev@lists.clearlinux.org)
6 | AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
7 | AM_SILENT_RULES([yes])
8 | AC_PROG_CC
9 | AM_PROG_CC_C_O
10 | AC_LANG(C)
11 | AC_CONFIG_MACRO_DIR([m4])
12 | AC_CONFIG_HEADERS([config.h])
13 |
14 | have_coverage=no
15 | AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable test coverage]))
16 | if test "x$enable_coverage" = "xyes" ; then
17 | AC_CHECK_PROG(lcov_found, [lcov], [yes], [no])
18 | if test "x$lcov_found" = xno ; then
19 | AC_MSG_ERROR([*** lcov support requested but the program was not found])
20 | else
21 | lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
22 | lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
23 | if test "$lcov_version_major" -eq 1 -a "$lcov_version_minor" -lt 10; then
24 | AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
25 | else
26 | have_coverage=yes
27 | AC_DEFINE([COVERAGE], [1], [Coverage enabled])
28 | fi
29 | fi
30 | fi
31 | AM_CONDITIONAL([COVERAGE], [test "$have_coverage" = "yes"])
32 |
33 | AC_CONFIG_FILES([Makefile])
34 | AC_OUTPUT
35 |
36 | AC_MSG_RESULT([
37 | $PACKAGE_NAME $VERSION
38 | ========
39 |
40 | prefix: ${prefix}
41 | libdir: ${libdir}
42 | sysconfdir: ${sysconfdir}
43 | exec_prefix: ${exec_prefix}
44 | bindir: ${bindir}
45 | datarootdir: ${datarootdir}
46 |
47 | compiler: ${CC}
48 | cflags: ${CFLAGS}
49 | ldflags: ${LDFLAGS}
50 | ])
51 |
--------------------------------------------------------------------------------
/findstatic.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -w
2 | # find a list of fns and variables in the code that could be static
3 | # usually called with something like this:
4 | # findstatic.pl `find . -name "*.o"`
5 | # Andrew Tridgell
6 |
7 | use strict;
8 |
9 | # use nm to find the symbols
10 | my($saved_delim) = $/;
11 | undef $/;
12 | my($syms) = `nm -o @ARGV`;
13 | $/ = $saved_delim;
14 |
15 | my(@lines) = split(/\n/s, $syms);
16 |
17 | my(%def);
18 | my(%undef);
19 | my(%stype);
20 |
21 | my(%typemap) = (
22 | "T" => "function",
23 | "C" => "uninitialised variable",
24 | "D" => "initialised variable"
25 | );
26 |
27 |
28 | # parse the symbols into defined and undefined
29 | for (my($i)=0; $i <= $#lines; $i++) {
30 | my($line) = $lines[$i];
31 | if ($line =~ /(.*):[a-f0-9]* ([TCD]) (.*)/) {
32 | my($fname) = $1;
33 | my($symbol) = $3;
34 | push(@{$def{$fname}}, $symbol);
35 | $stype{$symbol} = $2;
36 | }
37 | if ($line =~ /(.*):\s* U (.*)/) {
38 | my($fname) = $1;
39 | my($symbol) = $2;
40 | push(@{$undef{$fname}}, $symbol);
41 | }
42 | }
43 |
44 | # look for defined symbols that are never referenced outside the place they
45 | # are defined
46 | foreach my $f (keys %def) {
47 | print "Checking $f\n";
48 | my($found_one) = 0;
49 | foreach my $s (@{$def{$f}}) {
50 | my($found) = 0;
51 | foreach my $f2 (keys %undef) {
52 | if ($f2 ne $f) {
53 | foreach my $s2 (@{$undef{$f2}}) {
54 | if ($s2 eq $s) {
55 | $found = 1;
56 | $found_one = 1;
57 | }
58 | }
59 | }
60 | }
61 | if ($found == 0) {
62 | my($t) = $typemap{$stype{$s}};
63 | if ($s eq 'main') {
64 | # special case: main program
65 | $found_one = 1;
66 | } else {
67 | print " '$s' is unique to $f, should be static? ($t)\n";
68 | }
69 | }
70 | }
71 | if ($found_one == 0) {
72 | print " all symbols in '$f' are unused (main program?)\n";
73 | }
74 | }
75 |
76 |
--------------------------------------------------------------------------------
/src/filedesc.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Software Updater - client side
3 | *
4 | * Copyright © 2012-2015 Intel Corporation.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, version 2 or later of the License.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | * Authors:
19 | * Arjan van de Ven
20 | *
21 | */
22 |
23 | #define _GNU_SOURCE
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 |
31 |
32 | void dump_file_descriptor_leaks(void)
33 | {
34 | DIR *dir;
35 | struct dirent *entry;
36 |
37 | dir = opendir("/proc/self/fd");
38 | if (!dir)
39 | return;
40 |
41 | while (1) {
42 | char *filename;
43 | char buffer[PATH_MAX + 1];
44 | entry = readdir(dir);
45 | size_t size;
46 | if (!entry)
47 | break;
48 | if (strcmp(entry->d_name, ".") == 0)
49 | continue;
50 | if (strcmp(entry->d_name, "..") == 0)
51 | continue;
52 | /* skip stdin/out/err */
53 | if (strcmp(entry->d_name, "0") == 0)
54 | continue;
55 | if (strcmp(entry->d_name, "1") == 0)
56 | continue;
57 | if (strcmp(entry->d_name, "2") == 0)
58 | continue;
59 |
60 | /* we hold an fd open, the one from opendir above */
61 | sprintf(buffer, "%i", dirfd(dir));
62 | if (strcmp(entry->d_name, buffer) == 0)
63 | continue;
64 |
65 | if (asprintf(&filename, "/proc/self/fd/%s", entry->d_name) <= 0)
66 | abort();
67 | memset(&buffer, 0, sizeof(buffer));
68 | size = readlink(filename, buffer, PATH_MAX);
69 | if (size)
70 | printf("Possible filedescriptor leak : %s (%s)", entry->d_name, buffer);
71 | free(filename);
72 | }
73 |
74 | closedir(dir);
75 | }
76 |
--------------------------------------------------------------------------------
/coding-style.txt:
--------------------------------------------------------------------------------
1 | The formatting part of the coding style is easy; we follow the linux kernel
2 | style with one key exception:
3 |
4 | if/else statements ALWAYS have {}'s, even if there is only 1 statement.
5 | So
6 |
7 | if (foo) {
8 | bar();
9 | }
10 |
11 | the reason for this is that this is both less error-prone, and easier to put
12 | temporary or permanent logging/etc statements inside the {}'s.
13 |
14 |
15 |
16 |
17 |
18 | A note on error handling
19 | ========================
20 | The software in this project is system critical software, to a degree where
21 | failure really is not an option:
22 |
23 | The impact of the application failing is VERY SIGNIFICANT.
24 |
25 | For that reason, we need to take great care to get error handling robust,
26 | and not make some medium level issue worse by failing the whole system.
27 |
28 |
29 | Rule 1: In userspace, malloc() does not fail
30 | --------------------------------------------
31 | (The Thiago rule of memory management)
32 |
33 | In userspace, malloc() simply does not fail.
34 | "But But". We have 47 bits of address space to fill before malloc() would fail
35 | due to being out of space. It just won't happen.
36 |
37 | Because of this, we're not going to check for, or handle, malloc() failures.
38 | For one, in practice all you can do is exit, and the next line after
39 | malloc() will crash the program with the same effect.
40 |
41 | And more than that, the error handling, that never will be used, complicates
42 | the program code enormously and is impossible to test, and thus impossible
43 | to get right.
44 |
45 |
46 | Rule 2: Deal gracefully with expected failures
47 | ----------------------------------------------
48 | Some kind of errors are actually expected, normal conditions, and should be
49 | handled sensibly, business as usual. For example, the lack of configuration
50 | file should be handled silently by just using the system defaults.
51 |
52 |
53 | Rule 3: Correct unexpected failures
54 | -----------------------------------
55 | Other kind of errors are not expected. These kind of errors must be *fixed*
56 | as part of the error handling, so that the system can return to an expected
57 | situation. Just passing the error up the call chain is rarely the right
58 | answer, that just passes the buck to a part of the software that knows even
59 | less about how to properly correct the failure.
60 |
61 | Example: If a configuration file was required, but none exists, the error
62 | handling for this scenario should include writing out a reference
63 | configuration file with default values filled in.
64 |
65 | Example: If you really want to handle a memory allocation failure, you must
66 | free at least as much memory as you tried to allocate to allow the system to
67 | make progress in its execution.
68 |
--------------------------------------------------------------------------------
/src/main.c:
--------------------------------------------------------------------------------
1 | /*
2 | * usrbinjava - java wrapper
3 | *
4 | * Copyright (C) 2015 Intel Corporation.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, version 3, with OpenSSL-exception.
9 | *
10 | * Alternatively, you can chose to redistribute and/or modifiy this
11 | * software under the terms of the Apache-2.0 license as published
12 | * by the Apache Software Foundation.
13 | *
14 | * If you want to contribute code to this project using only one,
15 | * instead of both, of these licenses, you need to remove the other
16 | * license text from this file as part of your contribution.
17 | *
18 | * This program is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU General Public License for more details.
22 | *
23 | * You should have received a copy of the GNU General Public License
24 | * along with this program. If not, see .
25 | * Likewise, you should have received a copy of the Apache-2.0 license,
26 | * which can also be found at http://www.apache.org/licenses/LICENSE-2.0
27 | *
28 | * Authors:
29 | * Arjan van de Ven
30 | * Athenas Jimenez
31 | *
32 | */
33 |
34 | #define _GNU_SOURCE
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 |
41 |
42 | int main(int argc, char **argv)
43 | {
44 | char java[4096];
45 | strcpy(java, "/usr/bin/false");
46 |
47 | if (secure_getenv("JAVA_HOME")) {
48 | strcpy(java, secure_getenv("JAVA_HOME"));
49 | }
50 | else {
51 | if (access("/usr/lib/jvm/java-1.8.0-openjdk", F_OK) == 0) {
52 | strcpy(java, "/usr/lib/jvm/java-1.8.0-openjdk");
53 | setenv("JAVA_HOME", "/usr/lib/jvm/java-1.8.0-openjdk", 0);
54 | }
55 | else {
56 | if (access("/usr/lib/jvm/java-1.11.0-openjdk", F_OK) == 0) {
57 | strcpy(java, "/usr/lib/jvm/java-1.11.0-openjdk");
58 | setenv("JAVA_HOME", "/usr/lib/jvm/java-1.11.0-openjdk", 0);
59 | }
60 | else {
61 | if (access("/usr/lib/jvm/java-1.13.0-openjdk", F_OK) == 0) {
62 | strcpy(java, "/usr/lib/jvm/java-1.13.0-openjdk");
63 | setenv("JAVA_HOME", "/usr/lib/jvm/java-1.13.0-openjdk", 0);
64 | }
65 | }
66 | }
67 | }
68 |
69 | strcat(java, "/bin/");
70 | strncat(java, basename(argv[0]), 25);
71 |
72 | // If cannot access
73 | if (access(java, X_OK)) {
74 | fprintf(stderr, "Command not found at %s.\n", java);
75 | fprintf(stderr, "JAVA_HOME=%s\n", secure_getenv("JAVA_HOME"));
76 | return EXIT_FAILURE;
77 | }
78 |
79 | execvp(java, argv);
80 | return EXIT_SUCCESS;
81 | }
82 |
--------------------------------------------------------------------------------
/COPYING.Apache-2.0:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------