Author: mvidner Date: Fri Apr 24 13:24:09 2009 New Revision: 56965 URL: http://svn.opensuse.org/viewcvs/yast?rev=56965&view=rev Log: avoid y2log in both signal handler and forked children (bnc#493152) (applied coolo's hotfix from autobuild) Modified: trunk/core/agent-system/src/ShellCommand.cc trunk/core/liby2/src/Y2ProgramComponent.cc trunk/core/liby2/src/genericfrontend.cc trunk/core/liby2util-r/src/y2log.cc trunk/core/package/yast2-core.changes Modified: trunk/core/agent-system/src/ShellCommand.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-system/src/ShellCommand.cc?rev=56965&r1=56964&r2=56965&view=diff ============================================================================== --- trunk/core/agent-system/src/ShellCommand.cc (original) +++ trunk/core/agent-system/src/ShellCommand.cc Fri Apr 24 13:24:09 2009 @@ -117,7 +117,7 @@ FILE *stream2 = fdopen (pipe2[0], "r"); if (stream2 == 0) { - y2error ("stream2 fdopen error"); + y2error ("stream2 fdopen error"); _exit (1); } close (pipe2[1]); @@ -126,7 +126,8 @@ { if (out) fputs (s2, out); - y2debug ("%s", s2); + //bnc#493152#c24 + //y2debug ("%s", s2); } fclose (stream2); @@ -154,7 +155,7 @@ else ret = WTERMSIG (ret) + 128; - y2debug ("Exit status is %d", ret); + //y2debug ("Exit status is %d", ret); if (!tempdir.empty ()) { Modified: trunk/core/liby2/src/Y2ProgramComponent.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/liby2/src/Y2ProgramComponent.cc?rev=56965&r1=56964&r2=56965&view=diff ============================================================================== --- trunk/core/liby2/src/Y2ProgramComponent.cc (original) +++ trunk/core/liby2/src/Y2ProgramComponent.cc Fri Apr 24 13:24:09 2009 @@ -291,13 +291,14 @@ // Call chroot if desired. if (chroot_path == "" || chroot_path == "/") { - y2debug ("Going to execute %s", bin_file.c_str ()); + //bnc#493152#c24 + //y2debug ("Going to execute %s", bin_file.c_str ()); } else { - y2debug ("Going to execute %s with chroot %s", bin_file.c_str (), - chroot_path.c_str ()); + /*y2debug ("Going to execute %s with chroot %s", bin_file.c_str (), + chroot_path.c_str ());*/ if (chroot (chroot_path.c_str ()) != 0) { - y2error ("Cannot chroot to %s: %s", chroot_path.c_str (), - strerror (errno)); + /*y2error ("Cannot chroot to %s: %s", chroot_path.c_str (), + strerror (errno));*/ _exit (5); } @@ -307,7 +308,7 @@ execv (bin_file.c_str (), argv); // execute program // this code is only reached if exec failed - y2error ("Cannot execute external program %s", bin_file.c_str ()); + //y2error ("Cannot execute external program %s", bin_file.c_str ()); _exit (5); // No sense in returning! I am forked away!! } Modified: trunk/core/liby2/src/genericfrontend.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/liby2/src/genericfrontend.cc?rev=56965&r1=56964&r2=56965&view=diff ============================================================================== --- trunk/core/liby2/src/genericfrontend.cc (original) +++ trunk/core/liby2/src/genericfrontend.cc Fri Apr 24 13:24:09 2009 @@ -210,12 +210,14 @@ signal_handler (int sig) { signal (sig, SIG_IGN); +/* // bnc#493152#c19 only signal-safe functions are allowed fprintf (stderr, "YaST got signal %d at YCP file %s:%d\n", sig, ee.filename ().c_str (), ee.linenumber ()); y2error ("got signal %d at YCP file %s:%d", sig, ee.filename ().c_str (), ee.linenumber ()); log_stored_debug (); log_backtrace (); +*/ // bye signal (sig, SIG_DFL); kill ( getpid (), sig); Modified: trunk/core/liby2util-r/src/y2log.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/liby2util-r/src/y2log.cc?rev=56965&r1=56964&r2=56965&view=diff ============================================================================== --- trunk/core/liby2util-r/src/y2log.cc (original) +++ trunk/core/liby2util-r/src/y2log.cc Fri Apr 24 13:24:09 2009 @@ -119,7 +119,10 @@ FILE * newstderr = fdopen( dupstderr, "a" ); if ( newstderr == NULL ) { - fprintf( Y2LOG_STDERR, "y2log: Can't fdopen new stderr: %s.\n", strerror (errno) ); + char buf[100]; + //bnc#493152#c22 + strerror_r(errno, buf, sizeof(buf)-1); + fprintf( Y2LOG_STDERR, "y2log: Can't fdopen new stderr: %s.\n", buf); } else { fcntl (fileno (newstderr), F_SETFD, fcntl (fileno (newstderr), F_GETFD) | FD_CLOEXEC); @@ -127,7 +130,9 @@ } } else { - fprintf( Y2LOG_STDERR, "y2log: Can't dup stderr: %s.\n", strerror (errno) ); + char buf[100]; + strerror_r(errno, buf, sizeof(buf)-1); + fprintf( Y2LOG_STDERR, "y2log: Can't dup stderr: %s.\n", buf ); } return 1; } @@ -145,8 +150,10 @@ logfile = fopen (logname, "a"); } if (!logfile && !log_simple) { + char buf[100]; + strerror_r(errno, buf, sizeof(buf)-1); fprintf (Y2LOG_STDERR, "y2log: Error opening logfile '%s': %s.\n", - logname, strerror (errno)); + logname, buf); return NULL; } } @@ -244,17 +251,19 @@ #if 1 // just 1 second precision time_t timestamp = time (NULL); - struct tm *brokentime = localtime (×tamp); + struct tm brokentime; + localtime_r (×tamp, &brokentime); char date[50]; // that's big enough - strftime (date, sizeof (date), Y2LOG_DATE, brokentime); + strftime (date, sizeof (date), Y2LOG_DATE, &brokentime); #else // 1 millisecond precision (use only for testing) timeval time; gettimeofday (&time, NULL); time_t timestamp = time.tv_sec; - struct tm *brokentime = localtime (×tamp); + struct tm brokentime; + localtime_r (×tamp, &brokentime); char tmp1[50], date[50]; // that's big enough - strftime (tmp1, sizeof (tmp1), Y2LOG_DATE, brokentime); + strftime (tmp1, sizeof (tmp1), Y2LOG_DATE, &brokentime); snprintf (date, sizeof (date), "%s.%03ld", tmp1, time.tv_usec / 1000); #endif Modified: trunk/core/package/yast2-core.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?rev=56965&r1=56964&r2=56965&view=diff ============================================================================== --- trunk/core/package/yast2-core.changes (original) +++ trunk/core/package/yast2-core.changes Fri Apr 24 13:24:09 2009 @@ -7,6 +7,11 @@ - 2.18.7 ------------------------------------------------------------------- +Tue Apr 21 14:40:31 CEST 2009 - coolo@suse.de + +- avoid y2log in both signal handler and forked children (bnc#493152) + +------------------------------------------------------------------- Mon Apr 20 09:50:37 CEST 2009 - jreidinger@suse.cz - add builtin list::swap for list -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org