Author: mvidner Date: Fri Aug 5 10:55:21 2011 New Revision: 65235 URL: http://svn.opensuse.org/viewcvs/yast?rev=65235&view=rev Log: Prevent YaST hanging when threads are used (bnc#708367). backport: Use thread safe functions in logging fuctions (bnc#493152#c30) Modified: branches/SuSE-SLE-10-SP3-Branch/liby2util/VERSION branches/SuSE-SLE-10-SP3-Branch/liby2util/package/liby2util.changes branches/SuSE-SLE-10-SP3-Branch/liby2util/src/y2log.cc Modified: branches/SuSE-SLE-10-SP3-Branch/liby2util/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/liby2util/VERSION?rev=65235&r1=65234&r2=65235&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/liby2util/VERSION (original) +++ branches/SuSE-SLE-10-SP3-Branch/liby2util/VERSION Fri Aug 5 10:55:21 2011 @@ -1 +1 @@ -2.13.8 +2.13.8.1 Modified: branches/SuSE-SLE-10-SP3-Branch/liby2util/package/liby2util.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/liby2util/package/liby2util.changes?rev=65235&r1=65234&r2=65235&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/liby2util/package/liby2util.changes (original) +++ branches/SuSE-SLE-10-SP3-Branch/liby2util/package/liby2util.changes Fri Aug 5 10:55:21 2011 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Aug 5 08:54:30 CEST 2011 - mvidner@suse.cz + +- Prevent YaST hanging when threads are used (bnc#708367), backport: + Use thread safe functions in logging fuctions (bnc#493152#c30) +- 2.13.8.1 + +------------------------------------------------------------------- Fri Sep 1 15:05:04 CEST 2006 - mvidner@suse.cz - Fixed warnings in code using Rep.h when compiling with -W. Modified: branches/SuSE-SLE-10-SP3-Branch/liby2util/src/y2log.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP3-Branch/liby2util/src/y2log.cc?rev=65235&r1=65234&r2=65235&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP3-Branch/liby2util/src/y2log.cc (original) +++ branches/SuSE-SLE-10-SP3-Branch/liby2util/src/y2log.cc Fri Aug 5 10:55:21 2011 @@ -105,7 +105,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); @@ -113,7 +116,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; } @@ -206,8 +211,10 @@ if (*logname != '-') { 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 (%s:%d).\n", - logname, strerror (errno), file, line); + logname, buf, file, line); return; } } @@ -216,17 +223,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 @@ -280,8 +289,10 @@ if (*logname != '-') { 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; } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org