# HG changeset patch # User kizune # Date 1391790083 -14400 # Node ID 5f869a9e879ec866373559b6936d48bedfb46733 # Parent 69d1723b0f9121d64a183fbcfb0507dada0de877 8033618: Correct logging output Reviewed-by: ksrini, alanb, ahgross diff -r 69d1723b0f91 -r 5f869a9e879e src/share/native/com/sun/java/util/jar/pack/unpack.cpp --- a/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Tue Feb 04 13:12:16 2014 -0800 +++ b/src/share/native/com/sun/java/util/jar/pack/unpack.cpp Fri Feb 07 20:21:23 2014 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -4780,39 +4780,7 @@ } else if (log_file[0] != '\0' && (errstrm = fopen(log_file,"a+")) != NULL) { return; } else { - char log_file_name[PATH_MAX+100]; - char tmpdir[PATH_MAX]; -#ifdef WIN32 - int n = GetTempPath(PATH_MAX,tmpdir); //API returns with trailing '\' - if (n < 1 || n > PATH_MAX) { - sprintf(tmpdir,"C:\\"); - } - sprintf(log_file_name, "%sunpack.log", tmpdir); -#else - sprintf(tmpdir,"/tmp"); - sprintf(log_file_name, "/tmp/unpack.log"); -#endif - if ((errstrm = fopen(log_file_name, "a+")) != NULL) { - log_file = errstrm_name = saveStr(log_file_name); - return ; - } - - char *tname = tempnam(tmpdir,"#upkg"); - if (tname == NULL) return; - sprintf(log_file_name, "%s", tname); - ::free(tname); - if ((errstrm = fopen(log_file_name, "a+")) != NULL) { - log_file = errstrm_name = saveStr(log_file_name); - return ; - } -#ifndef WIN32 - sprintf(log_file_name, "/dev/null"); - // On windows most likely it will fail. - if ( (errstrm = fopen(log_file_name, "a+")) != NULL) { - log_file = errstrm_name = saveStr(log_file_name); - return ; - } -#endif + fprintf(stderr, "Can not open log file %s\n", log_file); // Last resort // (Do not use stdout, since it might be jarout->jarfp.) errstrm = stderr;