alaurie / rpms / plymouth

Forked from rpms/plymouth 4 days ago
Clone

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

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