HADOOP-12712. Fix some cmake plugin and native build warnings (cmccabe)
(cherry picked from commit b2c155f810
)
Conflicts:
hadoop-common-project/hadoop-common/CHANGES.txt
hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/cmakebuilder/CompileMojo.java
hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/cmakebuilder/TestMojo.java
hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/util/Exec.java
This commit is contained in:
parent
ada560bc4e
commit
de5175d216
|
@ -944,6 +944,8 @@ Release 2.8.0 - UNRELEASED
|
||||||
HADOOP-12356. Fix computing CPU usage statistics on Windows.
|
HADOOP-12356. Fix computing CPU usage statistics on Windows.
|
||||||
(Inigo Goiri via wangda)
|
(Inigo Goiri via wangda)
|
||||||
|
|
||||||
|
HADOOP-12712. Fix some cmake plugin and native build warnings (cmccabe)
|
||||||
|
|
||||||
Release 2.7.3 - UNRELEASED
|
Release 2.7.3 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -268,7 +268,7 @@ Java_org_apache_hadoop_net_unix_DomainSocket_validateSocketPathSecurity0(
|
||||||
JNIEnv *env, jclass clazz, jobject jstr, jint skipComponents)
|
JNIEnv *env, jclass clazz, jobject jstr, jint skipComponents)
|
||||||
{
|
{
|
||||||
jint utfLength;
|
jint utfLength;
|
||||||
char path[PATH_MAX], check[PATH_MAX], *token, *rest, *rest_free;
|
char path[PATH_MAX], check[PATH_MAX], *token, *rest, *rest_free = NULL;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int ret, mode, strlenPath;
|
int ret, mode, strlenPath;
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.InputStreamReader;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exec is a helper class for executing an external process from a mojo.
|
* Exec is a helper class for executing an external process from a mojo.
|
||||||
|
@ -93,7 +94,7 @@ public class Exec {
|
||||||
* OutputBufferThread is a background thread for consuming and storing output
|
* OutputBufferThread is a background thread for consuming and storing output
|
||||||
* of the external process.
|
* of the external process.
|
||||||
*/
|
*/
|
||||||
private static class OutputBufferThread extends Thread {
|
public static class OutputBufferThread extends Thread {
|
||||||
private List<String> output;
|
private List<String> output;
|
||||||
private BufferedReader reader;
|
private BufferedReader reader;
|
||||||
|
|
||||||
|
@ -126,12 +127,57 @@ public class Exec {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns every line consumed from the input.
|
* Get every line consumed from the input.
|
||||||
*
|
*
|
||||||
* @return List<String> every line consumed from the input
|
* @return Every line consumed from the input
|
||||||
*/
|
*/
|
||||||
public List<String> getOutput() {
|
public List<String> getOutput() {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add environment variables to a ProcessBuilder.
|
||||||
|
*
|
||||||
|
* @param pb The ProcessBuilder
|
||||||
|
* @param env A map of environment variable names to values.
|
||||||
|
*/
|
||||||
|
public static void addEnvironment(ProcessBuilder pb,
|
||||||
|
Map<String, String> env) {
|
||||||
|
if (env == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, String> processEnv = pb.environment();
|
||||||
|
for (Map.Entry<String, String> entry : env.entrySet()) {
|
||||||
|
String val = entry.getValue();
|
||||||
|
if (val == null) {
|
||||||
|
val = "";
|
||||||
|
}
|
||||||
|
processEnv.put(entry.getKey(), val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty-print the environment to a StringBuilder.
|
||||||
|
*
|
||||||
|
* @param env A map of environment variable names to values to print.
|
||||||
|
*
|
||||||
|
* @return The pretty-printed string.
|
||||||
|
*/
|
||||||
|
public static String envToString(Map<String, String> env) {
|
||||||
|
StringBuilder bld = new StringBuilder();
|
||||||
|
bld.append("{");
|
||||||
|
if (env != null) {
|
||||||
|
for (Map.Entry<String, String> entry : env.entrySet()) {
|
||||||
|
String val = entry.getValue();
|
||||||
|
if (val == null) {
|
||||||
|
val = "";
|
||||||
|
}
|
||||||
|
bld.append("\n ").append(entry.getKey()).
|
||||||
|
append(" = '").append(val).append("'\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bld.append("}");
|
||||||
|
return bld.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,7 +320,7 @@ char ** extract_values_delim(char *value, const char *delim) {
|
||||||
* Extracts array of values from the '%' separated list of values.
|
* Extracts array of values from the '%' separated list of values.
|
||||||
*/
|
*/
|
||||||
char ** extract_values(char *value) {
|
char ** extract_values(char *value) {
|
||||||
extract_values_delim(value, "%");
|
return extract_values_delim(value, "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
// free an entry set of values
|
// free an entry set of values
|
||||||
|
|
Loading…
Reference in New Issue