HADOOP-10810. Merging change r1610524 from trunk to branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1610526 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-07-14 20:57:33 +00:00
parent ea8da4b8c0
commit 168c721435
5 changed files with 19 additions and 13 deletions

View File

@ -25,6 +25,8 @@ Release 2.6.0 - UNRELEASED
HADOOP-10780. hadoop_user_info_alloc fails on FreeBSD due to incorrect HADOOP-10780. hadoop_user_info_alloc fails on FreeBSD due to incorrect
sysconf use (Dmitry Sivachenko via Colin Patrick McCabe) sysconf use (Dmitry Sivachenko via Colin Patrick McCabe)
HADOOP-10810. Clean up native code compilation warnings. (cnauroth)
Release 2.5.0 - UNRELEASED Release 2.5.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -379,6 +379,7 @@ Java_org_apache_hadoop_io_compress_zlib_ZlibCompressor_getLibraryName(JNIEnv *en
return (*env)->NewStringUTF(env, dl_info.dli_fname); return (*env)->NewStringUTF(env, dl_info.dli_fname);
} }
} }
return (*env)->NewStringUTF(env, "Unavailable");
#endif #endif
#ifdef WINDOWS #ifdef WINDOWS

View File

@ -580,6 +580,8 @@ Java_org_apache_hadoop_io_nativeio_NativeIO_00024POSIX_getUserName(
JNIEnv *env, jclass clazz, jint uid) JNIEnv *env, jclass clazz, jint uid)
{ {
#ifdef UNIX #ifdef UNIX
jstring jstr_username = NULL;
char *pw_buf = NULL;
int pw_lock_locked = 0; int pw_lock_locked = 0;
if (pw_lock_object != NULL) { if (pw_lock_object != NULL) {
if ((*env)->MonitorEnter(env, pw_lock_object) != JNI_OK) { if ((*env)->MonitorEnter(env, pw_lock_object) != JNI_OK) {
@ -588,7 +590,6 @@ Java_org_apache_hadoop_io_nativeio_NativeIO_00024POSIX_getUserName(
pw_lock_locked = 1; pw_lock_locked = 1;
} }
char *pw_buf = NULL;
int rc; int rc;
size_t pw_buflen = get_pw_buflen(); size_t pw_buflen = get_pw_buflen();
if ((pw_buf = malloc(pw_buflen)) == NULL) { if ((pw_buf = malloc(pw_buflen)) == NULL) {
@ -623,7 +624,7 @@ Java_org_apache_hadoop_io_nativeio_NativeIO_00024POSIX_getUserName(
goto cleanup; goto cleanup;
} }
jstring jstr_username = (*env)->NewStringUTF(env, pwd.pw_name); jstr_username = (*env)->NewStringUTF(env, pwd.pw_name);
cleanup: cleanup:
if (pw_lock_locked) { if (pw_lock_locked) {
@ -664,7 +665,7 @@ Java_org_apache_hadoop_io_nativeio_NativeIO_00024POSIX_mmap(
#ifdef WINDOWS #ifdef WINDOWS
THROW(env, "java/io/IOException", THROW(env, "java/io/IOException",
"The function POSIX.mmap() is not supported on Windows"); "The function POSIX.mmap() is not supported on Windows");
return NULL; return (jlong)(intptr_t)NULL;
#endif #endif
} }
@ -684,7 +685,6 @@ Java_org_apache_hadoop_io_nativeio_NativeIO_00024POSIX_munmap(
#ifdef WINDOWS #ifdef WINDOWS
THROW(env, "java/io/IOException", THROW(env, "java/io/IOException",
"The function POSIX.munmap() is not supported on Windows"); "The function POSIX.munmap() is not supported on Windows");
return NULL;
#endif #endif
} }
@ -700,6 +700,8 @@ Java_org_apache_hadoop_io_nativeio_NativeIO_00024POSIX_getGroupName(
JNIEnv *env, jclass clazz, jint gid) JNIEnv *env, jclass clazz, jint gid)
{ {
#ifdef UNIX #ifdef UNIX
jstring jstr_groupname = NULL;
char *pw_buf = NULL;
int pw_lock_locked = 0; int pw_lock_locked = 0;
if (pw_lock_object != NULL) { if (pw_lock_object != NULL) {
@ -709,7 +711,6 @@ Java_org_apache_hadoop_io_nativeio_NativeIO_00024POSIX_getGroupName(
pw_lock_locked = 1; pw_lock_locked = 1;
} }
char *pw_buf = NULL;
int rc; int rc;
size_t pw_buflen = get_pw_buflen(); size_t pw_buflen = get_pw_buflen();
if ((pw_buf = malloc(pw_buflen)) == NULL) { if ((pw_buf = malloc(pw_buflen)) == NULL) {
@ -744,7 +745,7 @@ Java_org_apache_hadoop_io_nativeio_NativeIO_00024POSIX_getGroupName(
goto cleanup; goto cleanup;
} }
jstring jstr_groupname = (*env)->NewStringUTF(env, grp.gr_name); jstr_groupname = (*env)->NewStringUTF(env, grp.gr_name);
PASS_EXCEPTIONS_GOTO(env, cleanup); PASS_EXCEPTIONS_GOTO(env, cleanup);
cleanup: cleanup:
@ -922,7 +923,7 @@ Java_org_apache_hadoop_io_nativeio_NativeIO_00024Windows_setFilePointer
#ifdef UNIX #ifdef UNIX
THROW(env, "java/io/IOException", THROW(env, "java/io/IOException",
"The function setFilePointer(FileDescriptor) is not supported on Unix"); "The function setFilePointer(FileDescriptor) is not supported on Unix");
return NULL; return (jlong)(intptr_t)NULL;
#endif #endif
#ifdef WINDOWS #ifdef WINDOWS
@ -957,7 +958,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_io_nativeio_NativeIO_00024Wind
#ifdef UNIX #ifdef UNIX
THROW(env, "java/io/IOException", THROW(env, "java/io/IOException",
"The function access0(path, access) is not supported on Unix"); "The function access0(path, access) is not supported on Unix");
return NULL; return (jlong)(intptr_t)NULL;
#endif #endif
#ifdef WINDOWS #ifdef WINDOWS

View File

@ -120,17 +120,19 @@ Java_org_apache_hadoop_net_unix_DomainSocketWatcher_00024FdSet_remove(
JNIEnv *env, jobject obj, jint fd) JNIEnv *env, jobject obj, jint fd)
{ {
struct fd_set_data *sd; struct fd_set_data *sd;
struct pollfd *pollfd, *last_pollfd; struct pollfd *pollfd = NULL, *last_pollfd;
int used_size, i; int used_size, i;
sd = (struct fd_set_data*)(intptr_t)(*env)-> sd = (struct fd_set_data*)(intptr_t)(*env)->
GetLongField(env, obj, fd_set_data_fid); GetLongField(env, obj, fd_set_data_fid);
used_size = sd->used_size; used_size = sd->used_size;
for (i = 0; i < used_size; i++) { for (i = 0; i < used_size; i++) {
if (sd->pollfd[i].fd == fd) {
pollfd = sd->pollfd + i; pollfd = sd->pollfd + i;
if (pollfd->fd == fd) break; break;
} }
if (i == used_size) { }
if (pollfd == NULL) {
(*env)->Throw(env, newRuntimeException(env, "failed to remove fd %d " (*env)->Throw(env, newRuntimeException(env, "failed to remove fd %d "
"from the FdSet because it was never present.", fd)); "from the FdSet because it was never present.", fd));
return; return;

View File

@ -45,7 +45,7 @@ static void throw_ioexception(JNIEnv* env, DWORD errnum)
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, *(DWORD*) (&errnum), // reinterpret cast NULL, *(DWORD*) (&errnum), // reinterpret cast
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR*)&buffer, 0, NULL); buffer, 0, NULL);
if (len > 0) if (len > 0)
{ {