Hello community,

here is the log from the commit of package yast2-core for openSUSE:Factory 
checked in at 2015-05-16 07:14:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-core (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-core.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-core"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-core/yast2-core.changes    2015-04-02 
16:02:35.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-core.new/yast2-core.changes       
2015-05-16 07:14:13.000000000 +0200
@@ -1,0 +2,5 @@
+Mon May 11 13:50:04 UTC 2015 - [email protected]
+
+- Fixed compilation warnings.
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-core.spec ++++++
--- /var/tmp/diff_new_pack.g4fxWk/_old  2015-05-16 07:14:14.000000000 +0200
+++ /var/tmp/diff_new_pack.g4fxWk/_new  2015-05-16 07:14:14.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-core
 #
-# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed

++++++ yast2-core-3.1.17.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/CONTRIBUTING.md 
new/yast2-core-3.1.17/CONTRIBUTING.md
--- old/yast2-core-3.1.17/CONTRIBUTING.md       2015-03-30 13:04:15.000000000 
+0200
+++ new/yast2-core-3.1.17/CONTRIBUTING.md       2015-05-13 10:34:11.000000000 
+0200
@@ -12,13 +12,13 @@
 -----------
 
 If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.novell.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
+[Bugzilla](https://bugzilla.suse.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
 or [GitHub issues](../../issues). (For Bugzilla, use the [simplified
 
registration](https://secure-www.novell.com/selfreg/jsp/createSimpleAccount.jsp)
 if you don't have an account yet.)
 
 If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.novell.com/) or GitHub issues. We can't guarantee
+[Bugzilla](https://bugzilla.suse.com/) or GitHub issues. We can't guarantee
 that every bug will be fixed, but we'll try.
 
 When creating a bug report, please follow our [bug reporting
@@ -71,7 +71,7 @@
 [widely used
 
conventions](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
 
-If your commit is related to a bug in Buzgilla or an issue on GitHub, make sure
+If your commit is related to a bug in Bugzilla or an issue on GitHub, make sure
 you mention it in the commit message for cross-reference. Use format like
 bnc#775814 or gh#yast/yast-foo#42. See also [GitHub
 
autolinking](https://help.github.com/articles/github-flavored-markdown#references)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/agent-any/src/AnyAgent.cc 
new/yast2-core-3.1.17/agent-any/src/AnyAgent.cc
--- old/yast2-core-3.1.17/agent-any/src/AnyAgent.cc     2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/agent-any/src/AnyAgent.cc     2015-05-13 
10:34:11.000000000 +0200
@@ -675,7 +675,9 @@
 
               // Do not allow touch outside of chroot especially `cd ~` can
               // cause errors
-              chdir("/");
+              res = chdir("/");
+              if (res == -1)
+                _exit(1);
             }
             // lets ignore if it fails, we even cannot log here
             setenv ("LC_ALL", "C", 1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/agent-any/src/Makefile.am 
new/yast2-core-3.1.17/agent-any/src/Makefile.am
--- old/yast2-core-3.1.17/agent-any/src/Makefile.am     2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/agent-any/src/Makefile.am     2015-05-13 
10:34:11.000000000 +0200
@@ -5,17 +5,11 @@
 AM_CXXFLAGS = -DY2LOG=\"agent-any\"
 
 plugin_LTLIBRARIES = libpy2ag_anyagent.la
-noinst_LTLIBRARIES = liby2ag_anyagent.la
 
-liby2ag_anyagent_la_SOURCES =                          \
+libpy2ag_anyagent_la_SOURCES =                         \
        AnyAgent.cc AnyAgent.h                          \
        AnyAgentBasic.cc                                \
-       AnyAgentComplex.cc
-liby2ag_anyagent_la_LDFLAGS = -version-info 2:0
-liby2ag_anyagent_la_LIBADD = @AGENT_LIBADD@
-
-libpy2ag_anyagent_la_SOURCES =                         \
-       $(liby2ag_anyagent_la_SOURCES)                  \
+       AnyAgentComplex.cc                              \
        Y2CCAnyAgent.cc
 libpy2ag_anyagent_la_LDFLAGS = -version-info 2:0
 libpy2ag_anyagent_la_LIBADD = @AGENT_LIBADD@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/agent-ini/src/IniParser.cc 
new/yast2-core-3.1.17/agent-ini/src/IniParser.cc
--- old/yast2-core-3.1.17/agent-ini/src/IniParser.cc    2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/agent-ini/src/IniParser.cc    2015-05-13 
10:34:11.000000000 +0200
@@ -770,7 +770,7 @@
                                    if (name_to_close.empty ()) {
                                        // there was no name or we did not find 
the specified one
                                        for (it = b; it != e; ++it) {
-                                           if ((*it)->getReadBy() == i)
+                                           if ((size_t)(*it)->getReadBy() == i)
                                                break;
                                        }
                                        if (it == e) {
@@ -1111,12 +1111,8 @@
     string file = sec;
     if (-1 != rb && (int) rewrites.size () > rb)
     {
-       int max = rewrites[rb].out.length () + sec.length () + 1;
-       char*buf = new char[max + 1];
-       snprintf (buf, max, rewrites[rb].out.c_str (), sec.c_str());
-       y2debug ("Rewriting %s to %s", sec.c_str(), buf);
-       file = buf;
-       delete [] buf;
+       file = format(rewrites[rb].out.c_str (), sec.c_str());
+       y2debug ("Rewriting %s to %s", sec.c_str(), file.c_str());
     }
     return file;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/agent-ini/src/Makefile.am 
new/yast2-core-3.1.17/agent-ini/src/Makefile.am
--- old/yast2-core-3.1.17/agent-ini/src/Makefile.am     2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/agent-ini/src/Makefile.am     2015-05-13 
10:34:11.000000000 +0200
@@ -5,9 +5,8 @@
 AM_CXXFLAGS = -DY2LOG=\"agent-ini\"
 
 plugin_LTLIBRARIES = libpy2ag_ini.la
-noinst_LTLIBRARIES = liby2ag_ini.la
 
-liby2ag_ini_la_SOURCES =       \
+libpy2ag_ini_la_SOURCES =      \
        IniAgent.cc             \
        IniAgent.h              \
        IniParser.cc            \
@@ -15,13 +14,7 @@
        IniFile.cc              \
        IniFile.h               \
        quotes.cc               \
-       quotes.h
-
-liby2ag_ini_la_LDFLAGS = -version-info 2:0
-liby2ag_ini_la_LIBADD = @AGENT_LIBADD@
-
-libpy2ag_ini_la_SOURCES =                      \
-        $(liby2ag_ini_la_SOURCES)              \
+       quotes.h                \
         Y2CCIniAgent.cc
 
 libpy2ag_ini_la_LDFLAGS = -version-info 2:0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/agent-modules/src/Makefile.am 
new/yast2-core-3.1.17/agent-modules/src/Makefile.am
--- old/yast2-core-3.1.17/agent-modules/src/Makefile.am 2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/agent-modules/src/Makefile.am 2015-05-13 
10:34:11.000000000 +0200
@@ -5,17 +5,11 @@
 AM_CXXFLAGS = -DY2LOG=\"agent-modules\"
 
 plugin_LTLIBRARIES = libpy2ag_modules.la
-noinst_LTLIBRARIES = liby2ag_modules.la
 
-liby2ag_modules_la_SOURCES =                   \
+libpy2ag_modules_la_SOURCES =                  \
        ModulesConf.h   ModulesConf.cc          \
        ModulesAgent.h  ModulesAgent.cc         \
-       Y2Logger.h
-liby2ag_modules_la_LDFLAGS = -version-info 2:0
-liby2ag_modules_la_LIBADD = @AGENT_LIBADD@
-
-libpy2ag_modules_la_SOURCES =                          \
-       $(liby2ag_modules_la_SOURCES)                   \
+       Y2Logger.h                              \
        Y2CCModulesAgent.cc
 libpy2ag_modules_la_LDFLAGS = -version-info 2:0
 libpy2ag_modules_la_LIBADD = @AGENT_LIBADD@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/agent-process/src/Makefile.am 
new/yast2-core-3.1.17/agent-process/src/Makefile.am
--- old/yast2-core-3.1.17/agent-process/src/Makefile.am 2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/agent-process/src/Makefile.am 2015-05-13 
10:34:11.000000000 +0200
@@ -5,17 +5,10 @@
 AM_CXXFLAGS = -DY2LOG=\"agent-process\" -Wall
 
 plugin_LTLIBRARIES = libpy2ag_process.la
-noinst_LTLIBRARIES = liby2ag_process.la
-
-liby2ag_process_la_SOURCES =                           \
-       ProcessAgent.cc                                 \
-       ProcessAgent.h
-
-liby2ag_process_la_LDFLAGS = -version-info 2:0
-liby2ag_process_la_LIBADD = @AGENT_LIBADD@
 
 libpy2ag_process_la_SOURCES =                          \
-        $(liby2ag_process_la_SOURCES)                  \
+       ProcessAgent.cc                                 \
+       ProcessAgent.h                                  \
         Y2CCProcessAgent.cc
 libpy2ag_process_la_LDFLAGS = -version-info 2:0
 libpy2ag_process_la_LIBADD = @AGENT_LIBADD@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/agent-system/src/ShellCommand.cc 
new/yast2-core-3.1.17/agent-system/src/ShellCommand.cc
--- old/yast2-core-3.1.17/agent-system/src/ShellCommand.cc      2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/agent-system/src/ShellCommand.cc      2015-05-13 
10:34:11.000000000 +0200
@@ -162,7 +162,9 @@
 
                 // Do not allow touch outside of chroot especially `cd ~` can
                 // cause errors
-                chdir("/");
+                res = chdir("/");
+                if (res == -1)
+                    _exit(1);
             }
 
            ret = system (command.c_str ());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/base/tools/startshell/startshell.c 
new/yast2-core-3.1.17/base/tools/startshell/startshell.c
--- old/yast2-core-3.1.17/base/tools/startshell/startshell.c    2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/base/tools/startshell/startshell.c    2015-05-13 
10:34:11.000000000 +0200
@@ -26,10 +26,13 @@
     fclose (stdout);
     fclose (stderr);
     setsid ();
-    fd_ii = open (tty_tv, O_RDWR);
+    fd_ii = open (tty_tv, O_RDWR); /* stdin at tty */
     ioctl (fd_ii, TIOCSCTTY, (void *)1);
-    dup (fd_ii);
-    dup (fd_ii);
+    /* we don't need the fd numbers;
+       and if an error occurs we don't have a fd to write it to */
+    int    dupfd __attribute__ ((unused));
+    dupfd = dup (fd_ii);        /* stdout at tty */
+    dupfd = dup (fd_ii);        /* stderr at tty */
 
     execve ("/bin/bash", args_apci, env_pci);
     fprintf (stderr, "Couldn't start shell (errno = %d)\n", errno);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/liby2/src/Y2ProgramComponent.cc 
new/yast2-core-3.1.17/liby2/src/Y2ProgramComponent.cc
--- old/yast2-core-3.1.17/liby2/src/Y2ProgramComponent.cc       2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/liby2/src/Y2ProgramComponent.cc       2015-05-13 
10:34:11.000000000 +0200
@@ -302,7 +302,9 @@
                _exit (5);
            }
 
-           chdir ("/");
+           if (chdir ("/") != 0) {
+               _exit (5);
+            }
        }
 
        // close all filedescriptors above stderr, bnc#501758
@@ -419,7 +421,10 @@
     // result (..) from the input pipe, which is very important. Otherwise the
     // result value would be dropped.
 
-    write(to_external[1], "\n", 1);
+    if (write(to_external[1], "\n", 1) != 1)
+    {
+        y2error ("Couldn't write LF: %s", strerror(errno));
+    }
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/liby2/src/Y2SerialComponent.cc 
new/yast2-core-3.1.17/liby2/src/Y2SerialComponent.cc
--- old/yast2-core-3.1.17/liby2/src/Y2SerialComponent.cc        2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/liby2/src/Y2SerialComponent.cc        2015-05-13 
10:34:11.000000000 +0200
@@ -344,23 +344,31 @@
 
         // first write one space so the other side gets
         // fullfilled its necessities
-        write(fd_serial, space_buf, 1);
+        if (write(fd_serial, space_buf, 1) != 1)
+        {
+           y2error ("Couldn't write 1 space: %s", strerror(errno));
+        }
 
         // now wait for a space to be read
         // (the other side has the same behaviour)
         if (await_readable(TIMEOUT))
         {
-           read(fd_serial, buf, 1);                // read one byte
+           size_t r = read(fd_serial, buf, 1);     // read one byte
 
-           if (buf[0] == ' ') spaces_read++;       // was a space
-           else               spaces_read = 0;     // trash read --> reset
+           if (r == 1 && buf[0] == ' ')
+               spaces_read++;                      // was a space
+           else
+               spaces_read = 0;                    // trash read --> reset
         }
       }
 
       // now that we've got our NUMSPACES spaces write 2 * NUMSPACES spaces to
       // the other side to avoid syncing problems. the remote parser will 
kindly
       // ignore them.
-      write(fd_serial, space_buf, 2 * NUMSPACES);
+      if (write(fd_serial, space_buf, 2 * NUMSPACES) != 2 * NUMSPACES)
+      {
+          y2error ("Couldn't write spaces: %s", strerror(errno));
+      }
 
       // now set our parser to the serial line to start communication
       parser.setInput(fd_serial, device_name.c_str());
@@ -378,7 +386,12 @@
 {
     string s  = "(" + v->toString() + ")\n";    // store string in string 
variable ..
     const char *cs = s.c_str();                        // c_str is valid als 
long as s
-    write(fd_serial, cs, strlen(cs));
+    size_t len = s.length();
+    size_t w = write(fd_serial, cs, len);
+    if (w != len)
+    {
+        y2error ("wrote only %zu of %zu bytes: %s", w, len, strerror(errno));
+    }
 }
 
 YCPValue Y2SerialComponent::receiveFromSerial()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/liby2/src/Y2StdioComponent.cc 
new/yast2-core-3.1.17/liby2/src/Y2StdioComponent.cc
--- old/yast2-core-3.1.17/liby2/src/Y2StdioComponent.cc 2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/liby2/src/Y2StdioComponent.cc 2015-05-13 
10:34:11.000000000 +0200
@@ -127,7 +127,15 @@
 {
     string s = "(" + (v.isNull () ? "(nil)" : v->toString ()) + ")\n";
     y2debug ("send begin %s", s.c_str ());
-    write (to_stderr ? STDERR_FILENO : STDOUT_FILENO, s.c_str (), s.length ());
+
+    int fd = to_stderr ? STDERR_FILENO : STDOUT_FILENO;
+    size_t len = s.length ();
+    size_t w = write (fd, s.c_str (), len);
+    if (w != len)
+    {
+        y2error ("wrote only %zu of %zu bytes: %s", w, len, strerror(errno));
+    }
+
     y2debug ("send end %s", s.c_str ());
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/liby2/src/genericfrontend.cc 
new/yast2-core-3.1.17/liby2/src/genericfrontend.cc
--- old/yast2-core-3.1.17/liby2/src/genericfrontend.cc  2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/liby2/src/genericfrontend.cc  2015-05-13 
10:34:11.000000000 +0200
@@ -104,6 +104,7 @@
 #include <YCP.h>
 #include <ycp/Parser.h>
 #include <ycp/pathsearch.h>
+#include <y2util/stringutil.h>
 #include "exitcodes.h"
 #include <debugger/Debugger.h>
 
@@ -852,17 +853,16 @@
 static void
 print_error (const char* format, ...)
 {
-    char* msg;
-
     va_list ap;
     va_start (ap, format);
-    vasprintf (&msg, format, ap);
+
+    string str = stringutil::vform(format, ap);
+    const char * msg = str.c_str();
+
     va_end (ap);
 
-    fprintf (stderr, "%s\n", msg);
+    fputs (msg, stderr);
     y2error ("%s", msg);
-
-    free (msg);
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-core-3.1.17/liby2util-r/src/include/y2util/stringutil.h 
new/yast2-core-3.1.17/liby2util-r/src/include/y2util/stringutil.h
--- old/yast2-core-3.1.17/liby2util-r/src/include/y2util/stringutil.h   
2015-03-30 13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/liby2util-r/src/include/y2util/stringutil.h   
2015-05-13 10:34:11.000000000 +0200
@@ -46,6 +46,18 @@
   TRIM    = (L_TRIM|R_TRIM)
 };
 
+inline std::string vform( const char * format, va_list ap ) {
+  char * buf = 0;
+  std::string val;
+
+  int numprinted = vasprintf( &buf, format, ap );
+  if ( numprinted >= 0 ) {
+    val = buf;
+    free( buf );
+  }
+  return val;
+}
+
 inline std::string form( const char * format, ... )
     __attribute__ ((format (printf, 1, 2)));
 
@@ -59,35 +71,19 @@
  * </PRE>
  **/
 inline std::string form( const char * format, ... ) {
-  char * buf = 0;
   std::string val;
 
   va_list ap;
   va_start( ap, format );
 
-#if 1
-  int numprinted = vasprintf( &buf, format, ap );
-  if ( numprinted >= 0 ) {
-    val = buf;
-    free( buf );
-  }
-#else
-  // Don't know wheter we actually nedd two va_lists, one to
-  // evaluate the buffer size needed, and one to actually fill
-  // the buffer. Maybe there's a save way to reuse a va_lists.
-  va_list ap1;
-  va_start( ap1, format );
-  buf = new char[vsnprintf( NULL, 0, format, ap ) + 1];
-  vsprintf( buf, format, ap1 );
-  val = buf;
-  delete [] buf;
-  va_end( ap1 );
-#endif
+  val = vform(format, ap);
 
   va_end( ap );
   return val;
 }
 
+
+
 /**
  * Print number. Optional second argument sets the minimal string width (' ' 
padded).
  * Negative values will cause the number to be left adjusted within the 
string. Default
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-core-3.1.17/liby2util-r/src/include/y2util/y2log.h 
new/yast2-core-3.1.17/liby2util-r/src/include/y2util/y2log.h
--- old/yast2-core-3.1.17/liby2util-r/src/include/y2util/y2log.h        
2015-03-30 13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/liby2util-r/src/include/y2util/y2log.h        
2015-05-13 10:34:11.000000000 +0200
@@ -160,6 +160,13 @@
  */
 bool get_log_debug();
 
+/**
+ * Check if the logs need rotating; if yes, do it.
+ * We do all of this ourselves because during the installation
+ * logrotate does not run
+ */
+void shift_log_files_if_needed(string filename);
+
 // stores a few strings. can append one. can return all. old are forgotten.
 class LogTail {
 public:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/liby2util-r/src/y2changes.cc 
new/yast2-core-3.1.17/liby2util-r/src/y2changes.cc
--- old/yast2-core-3.1.17/liby2util-r/src/y2changes.cc  2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/liby2util-r/src/y2changes.cc  2015-05-13 
10:34:11.000000000 +0200
@@ -28,14 +28,13 @@
 #include <list>
 
 #include "y2util/y2changes.h"
+#include "y2util/y2log.h"
 #include "y2util/stringutil.h"
 #include "y2util/PathInfo.h"
 #include <syslog.h>
 
 /* Defines */
 
-#define _GNU_SOURCE 1                          /* Needed for vasprintf below */
-
 #define Y2CHANGES_DATE "%Y-%m-%d %H:%M:%S"     /* The date format */
 
 // 1 timestamp, 2 level, 3 hostname
@@ -71,7 +70,6 @@
 
 /* static prototypes */
 static void do_log_yast( const char* logmessage );
-static void shift_log_files(string filename);
 
 static const char *log_messages[] = {
     "item",
@@ -139,10 +137,7 @@
     char date[50];             // that's big enough
     strftime (date, sizeof (date), Y2CHANGES_DATE, brokentime);
 
-    char * result_c = NULL;
-    asprintf (&result_c, Y2CHANGES_FORMAT, date, log_messages[category], 
hostname );
-    string result = result_c;
-    free (result_c);
+    string result = stringutil::form(Y2CHANGES_FORMAT, date, 
log_messages[category], hostname );
 
     return result;
 }
@@ -156,11 +151,7 @@
     va_start(ap, format);
 
     /* Prepare the log text */
-    char *logtext = NULL;
-    vasprintf(&logtext, format, ap); /* GNU extension needs the define above */
-    string common = logtext;
-    common += '\n';
-    free (logtext);
+    string common = stringutil::vform(format, ap) + '\n';
 
     if(log_to_syslog) {
        syslog (LOG_NOTICE, Y2CHANGES_SYSLOG, category, common.c_str ());
@@ -177,7 +168,7 @@
 /**
  * Logfile name initialization
  */
-static void set_log_filename (string fname)
+static void y2changes_set_log_filename (string fname)
 {
     did_set_logname = true;
 
@@ -236,10 +227,10 @@
 void do_log_yast( const char* logmessage )
 {
     /* Prepare the logfile name */
-    if(!did_set_logname) set_log_filename("");
+    if(!did_set_logname) y2changes_set_log_filename("");
 
     /* Prepare the logfile */
-    shift_log_files (string (logname));
+    shift_log_files_if_needed (string (logname));
 
     FILE *logfile = open_logfile ();
     if (!logfile)
@@ -254,45 +245,4 @@
        fflush (logfile);
 }
 
-static string old (const string & filename, int i, const char * suffix) {
-    char numbuf[8];
-    sprintf (numbuf, "%d", i);
-    return filename + "-" + numbuf + suffix;
-}
-
-/**
- * Maintain logfiles
- * We do all of this ourselves because during the installation
- * logrotate does not run
- */
-static void shift_log_files(string filename)
-{
-    struct stat buf;
-
-    if( stat(filename.c_str(), &buf) )
-       return;
-
-    if( buf.st_size <= maxlogsize )
-       return;
-
-    static const char * gz = ".gz";
-    // Delete the last logfile
-    remove (old (filename, maxlognum - 1, ""   ).c_str());
-    remove (old (filename, maxlognum - 1, gz).c_str());
-
-    // rename existing ones
-    for( int f = maxlognum-2; f > 0; f-- )
-    {
-       rename (old (filename, f, "").c_str(), old (filename, f+1, "").c_str());
-       rename (old (filename, f, gz).c_str(), old (filename, f+1, gz).c_str());
-    }
-
-    // rename and compress first one
-    rename( filename.c_str(), old (filename, 1, "").c_str() );
-    // fate#300637: compress!
-    // may fail, but so what
-    system( ("nice -n 20 gzip " + old (filename, 1, "") + " &").c_str());
-}
-
-
 /* EOF */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/liby2util-r/src/y2log.cc 
new/yast2-core-3.1.17/liby2util-r/src/y2log.cc
--- old/yast2-core-3.1.17/liby2util-r/src/y2log.cc      2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/liby2util-r/src/y2log.cc      2015-05-13 
10:34:11.000000000 +0200
@@ -36,8 +36,6 @@
 
 /* Defines */
 
-#define _GNU_SOURCE 1                          /* Needed for vasprintf below */
-
 #define Y2LOG_DATE     "%Y-%m-%d %H:%M:%S"     /* The date format */
 
 // 1 component, 2 file, 3 func, 4 line, 5 logtext, 6 eol
@@ -93,7 +91,6 @@
 /* static prototypes */
 static void do_log_syslog( const char* logmessage );
 static void do_log_yast( const char* logmessage );
-static void shift_log_files(string filename);
 
 /**
  * y2log must use a private copy of stderr, esp. in case we're always logging
@@ -178,8 +175,7 @@
           const int line, const char *function, const char *format, va_list ap)
 {
     /* Prepare the log text */
-    char *logtext = NULL;
-    vasprintf(&logtext, format, ap); /* GNU extension needs the define above */
+    string logtext = stringutil::vform(format, ap);
 
     /* Prepare the component */
     string comp = component;
@@ -212,18 +208,12 @@
        func = "(" + func + ")";
 
     /* do we need EOL? */
-    bool eol = false;
-    size_t len = strlen(logtext);
-    if ((len==0) || ((len>0) && (logtext[len-1]!='\n')))
-       eol = true;
-
-    char * result_c;
-    asprintf(&result_c, simple? Y2LOG_SIMPLE: Y2LOG_COMMON,
-            comp.c_str (), file, func.c_str (), line, logtext, eol?"\n":"");
-    string result = result_c;
-    free (result_c);
+    bool need_eol = logtext.empty () || (logtext.back () != '\n');
+
+    string result = stringutil::form(simple ? Y2LOG_SIMPLE : Y2LOG_COMMON,
+                                     comp.c_str (), file, func.c_str (), line,
+                                     logtext.c_str (), need_eol?"\n":"");
 
-    free (logtext);
     return result;
 }
 
@@ -268,10 +258,7 @@
     strcat (date, tmp2);
 #endif
 
-    char * result_c = NULL;
-    asprintf (&result_c, Y2LOG_FORMAT, date, level, hostname, pid);
-    string result = result_c;
-    free (result_c);
+    string result = stringutil::form(Y2LOG_FORMAT, date, level, hostname, pid);
 
     return result;
 }
@@ -344,7 +331,7 @@
     if(!did_set_logname) set_log_filename("");
 
     /* Prepare the logfile */
-    shift_log_files (string (logname));
+    shift_log_files_if_needed (string (logname));
 
     FILE *logfile = open_logfile ();
     if (!logfile)
@@ -439,7 +426,7 @@
  * We do all of this ourselves because during the installation
  * logrotate does not run
  */
-static void shift_log_files(string filename)
+void shift_log_files_if_needed(string filename)
 {
     struct stat buf;
 
@@ -464,8 +451,9 @@
     // rename and compress first one
     rename( filename.c_str(), old (filename, 1, "").c_str() );
     // fate#300637: compress!
-    // may fail, but so what
-    system( ("nice -n 20 gzip " + old (filename, 1, "") + " &").c_str());
+    // If compression fails it is acceptable, and we cannot log anyway.
+    int r __attribute__ ((unused));
+    r = system( ("nice -n 20 gzip " + old (filename, 1, "") + " &").c_str());
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/libycp/src/pathsearch.cc 
new/yast2-core-3.1.17/libycp/src/pathsearch.cc
--- old/yast2-core-3.1.17/libycp/src/pathsearch.cc      2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/libycp/src/pathsearch.cc      2015-05-13 
10:34:11.000000000 +0200
@@ -192,7 +192,7 @@
     {
        // Check at least if it is executable (for others) and
        // if it is a regular file.
-       if (S_ISREG (buf.st_mode) && (buf.st_mode & S_IXOTH == S_IXOTH))
+       if (S_ISREG (buf.st_mode) && ((buf.st_mode & S_IXOTH) == S_IXOTH))
        {
            return pathname;
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-core-3.1.17/package/yast2-core.changes 
new/yast2-core-3.1.17/package/yast2-core.changes
--- old/yast2-core-3.1.17/package/yast2-core.changes    2015-03-30 
13:04:15.000000000 +0200
+++ new/yast2-core-3.1.17/package/yast2-core.changes    2015-05-13 
10:34:11.000000000 +0200
@@ -1,4 +1,9 @@
 -------------------------------------------------------------------
+Mon May 11 13:50:04 UTC 2015 - [email protected]
+
+- Fixed compilation warnings.
+
+-------------------------------------------------------------------
 Mon Mar 30 10:55:31 UTC 2015 - [email protected]
 
 - Fix YCP symbol comparison with GCC 5 (thanks schubi for


Reply via email to