Blame SOURCES/0001-Revert-Recreate-boot-log-at-each-boot-instead-of-app.patch

7cd153
From 3edbaf6559eb81243326ebe79dc53b0759809a68 Mon Sep 17 00:00:00 2001
7cd153
From: Ray Strode <rstrode@redhat.com>
7cd153
Date: Fri, 24 Mar 2017 15:31:51 -0400
7cd153
Subject: [PATCH] Revert "Recreate boot log at each boot instead of appending"
7cd153
7cd153
This reverts commit 9abbd88835a181cda1427d61d92ef5685ad8a81b.
7cd153
---
7cd153
 src/libply/ply-logger.c           | 2 +-
7cd153
 src/libply/ply-terminal-session.c | 5 ++---
7cd153
 2 files changed, 3 insertions(+), 4 deletions(-)
7cd153
7cd153
diff --git a/src/libply/ply-logger.c b/src/libply/ply-logger.c
7cd153
index 740c30e..dfd5c0a 100644
7cd153
--- a/src/libply/ply-logger.c
7cd153
+++ b/src/libply/ply-logger.c
7cd153
@@ -13,61 +13,61 @@
7cd153
  * GNU General Public License for more details.
7cd153
  *
7cd153
  * You should have received a copy of the GNU General Public License
7cd153
  * along with this program; if not, write to the Free Software
7cd153
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
7cd153
  * 02111-1307, USA.
7cd153
  *
7cd153
  * Written by: Ray Strode <rstrode@redhat.com>
7cd153
  */
7cd153
 #include "config.h"
7cd153
 #include "ply-logger.h"
7cd153
 
7cd153
 #include <assert.h>
7cd153
 #include <ctype.h>
7cd153
 #include <errno.h>
7cd153
 #include <fcntl.h>
7cd153
 #include <stdarg.h>
7cd153
 #include <stdio.h>
7cd153
 #include <stdlib.h>
7cd153
 #include <string.h>
7cd153
 #include <sys/fcntl.h>
7cd153
 #include <sys/file.h>
7cd153
 #include <sys/stat.h>
7cd153
 #include <sys/types.h>
7cd153
 #include <unistd.h>
7cd153
 
7cd153
 #include "ply-utils.h"
7cd153
 #include "ply-list.h"
7cd153
 
7cd153
 #ifndef PLY_LOGGER_OPEN_FLAGS
7cd153
-#define PLY_LOGGER_OPEN_FLAGS (O_WRONLY | O_TRUNC | O_CREAT | O_NOFOLLOW | O_CLOEXEC)
7cd153
+#define PLY_LOGGER_OPEN_FLAGS (O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW | O_CLOEXEC)
7cd153
 #endif
7cd153
 
7cd153
 #ifndef PLY_LOGGER_MAX_INJECTION_SIZE
7cd153
 #define PLY_LOGGER_MAX_INJECTION_SIZE 4096
7cd153
 #endif
7cd153
 
7cd153
 #ifndef PLY_LOGGER_MAX_BUFFER_CAPACITY
7cd153
 #define PLY_LOGGER_MAX_BUFFER_CAPACITY (8 * 4096)
7cd153
 #endif
7cd153
 
7cd153
 typedef struct
7cd153
 {
7cd153
   ply_logger_filter_handler_t  handler;
7cd153
   void                        *user_data;
7cd153
 } ply_logger_filter_t;
7cd153
 
7cd153
 struct _ply_logger
7cd153
 {
7cd153
   int output_fd;
7cd153
   char *filename;
7cd153
 
7cd153
   char *buffer;
7cd153
   size_t buffer_size;
7cd153
   size_t buffer_capacity;
7cd153
 
7cd153
   ply_logger_flush_policy_t flush_policy;
7cd153
   ply_list_t *filters;
7cd153
 
7cd153
   uint32_t is_enabled : 1;
7cd153
   uint32_t tracing_is_enabled : 1;
7cd153
diff --git a/src/libply/ply-terminal-session.c b/src/libply/ply-terminal-session.c
7cd153
index 379035c..143eed6 100644
7cd153
--- a/src/libply/ply-terminal-session.c
7cd153
+++ b/src/libply/ply-terminal-session.c
7cd153
@@ -531,60 +531,59 @@ ply_terminal_session_start_logging (ply_terminal_session_t *session)
7cd153
 
7cd153
   assert (session_fd >= 0);
7cd153
 
7cd153
   session->fd_watch = ply_event_loop_watch_fd (session->loop,
7cd153
                                                session_fd,
7cd153
                                                PLY_EVENT_LOOP_FD_STATUS_HAS_DATA,
7cd153
                                                (ply_event_handler_t)
7cd153
                                                ply_terminal_session_on_new_data, 
7cd153
                                                (ply_event_handler_t)
7cd153
                                                ply_terminal_session_on_hangup,
7cd153
                                                session);
7cd153
 }
7cd153
 
7cd153
 static void
7cd153
 ply_terminal_session_stop_logging (ply_terminal_session_t *session)
7cd153
 {
7cd153
   assert (session != NULL);
7cd153
   assert (session->logger != NULL);
7cd153
 
7cd153
   ply_trace ("stopping logging of incoming console messages");
7cd153
   if (ply_logger_is_logging (session->logger))
7cd153
     ply_logger_toggle_logging (session->logger);
7cd153
 
7cd153
   if (session->loop != NULL &&
7cd153
       session->fd_watch != NULL)
7cd153
     ply_event_loop_stop_watching_fd (session->loop,
7cd153
                                      session->fd_watch);
7cd153
   session->fd_watch = NULL;
7cd153
 }
7cd153
 
7cd153
-bool 
7cd153
+bool
7cd153
 ply_terminal_session_open_log (ply_terminal_session_t *session,
7cd153
                                const char             *filename)
7cd153
 {
7cd153
   bool log_is_opened;
7cd153
 
7cd153
   assert (session != NULL);
7cd153
   assert (filename != NULL);
7cd153
   assert (session->logger != NULL);
7cd153
 
7cd153
   ply_save_errno ();
7cd153
-  unlink (filename);
7cd153
   log_is_opened = ply_logger_open_file (session->logger, filename, true);
7cd153
   if (log_is_opened)
7cd153
     ply_logger_flush (session->logger);
7cd153
   ply_restore_errno ();
7cd153
 
7cd153
   return log_is_opened;
7cd153
 }
7cd153
 
7cd153
-void 
7cd153
+void
7cd153
 ply_terminal_session_close_log (ply_terminal_session_t *session)
7cd153
 {
7cd153
   assert (session != NULL);
7cd153
   assert (session->logger != NULL);
7cd153
 
7cd153
   return ply_logger_close_file (session->logger);
7cd153
 }
7cd153
 
7cd153
 /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
7cd153
-- 
7cd153
2.12.2
7cd153