OpenJDK / amber / amber
changeset 39569:ce8a7a71f56b
8160831: GioFileTypeDetector always calls deprecated g_type_init
Summary: Ensure that g_type_init is non-null before using it.
Reviewed-by: alanb
Contributed-by: Martin Walsh <martin.walsh@oracle.com>
author | bpb |
---|---|
date | Mon, 11 Jul 2016 14:46:21 -0700 |
parents | 1987f3929c39 |
children | f774415f91ad |
files | jdk/src/java.base/linux/native/libnio/fs/GioFileTypeDetector.c |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/src/java.base/linux/native/libnio/fs/GioFileTypeDetector.c Mon May 23 23:12:05 2016 +0800 +++ b/jdk/src/java.base/linux/native/libnio/fs/GioFileTypeDetector.c Mon Jul 11 14:46:21 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,7 +91,6 @@ } g_type_init = (g_type_init_func)dlsym(gio_handle, "g_type_init"); - (*g_type_init)(); g_object_unref = (g_object_unref_func)dlsym(gio_handle, "g_object_unref"); @@ -104,9 +103,7 @@ g_file_info_get_content_type = (g_file_info_get_content_type_func) dlsym(gio_handle, "g_file_info_get_content_type"); - - if (g_type_init == NULL || - g_object_unref == NULL || + if (g_object_unref == NULL || g_file_new_for_path == NULL || g_file_query_info == NULL || g_file_info_get_content_type == NULL) @@ -115,7 +112,10 @@ return JNI_FALSE; } - (*g_type_init)(); + if (g_type_init != NULL) { + (*g_type_init)(); + } + return JNI_TRUE; }