ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
dd65c9
From 95ee3c8f1ef9408543c962af5f21e01ccef544e1 Mon Sep 17 00:00:00 2001
dd65c9
From: Michal Sekletar <msekleta@redhat.com>
dd65c9
Date: Thu, 7 Sep 2017 15:46:24 +0200
dd65c9
Subject: [PATCH] tmpfiles: warn if we get an argument on lines that don't take
dd65c9
 any
dd65c9
dd65c9
(cherry picked from commit c82500c6fb37a25bc3c4b1e0be11a90a395619d9)
dd65c9
dd65c9
Related: #1299714
dd65c9
---
dd65c9
 src/tmpfiles/tmpfiles.c | 9 +++++++--
dd65c9
 1 file changed, 7 insertions(+), 2 deletions(-)
dd65c9
dd65c9
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
dd65c9
index 800e620bc..70e0cc2fa 100644
dd65c9
--- a/src/tmpfiles/tmpfiles.c
dd65c9
+++ b/src/tmpfiles/tmpfiles.c
dd65c9
@@ -1788,8 +1788,6 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
dd65c9
 
dd65c9
         switch (i.type) {
dd65c9
 
dd65c9
-        case CREATE_FILE:
dd65c9
-        case TRUNCATE_FILE:
dd65c9
         case CREATE_DIRECTORY:
dd65c9
         case CREATE_SUBVOLUME:
dd65c9
         case EMPTY_DIRECTORY:
dd65c9
@@ -1802,6 +1800,13 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
dd65c9
         case ADJUST_MODE:
dd65c9
         case RELABEL_PATH:
dd65c9
         case RECURSIVE_RELABEL_PATH:
dd65c9
+                if (i.argument)
dd65c9
+                        log_warning("[%s:%u] %c lines don't take argument field, ignoring.", fname, line, i.type);
dd65c9
+
dd65c9
+                break;
dd65c9
+
dd65c9
+        case CREATE_FILE:
dd65c9
+        case TRUNCATE_FILE:
dd65c9
                 break;
dd65c9
 
dd65c9
         case CREATE_SYMLINK: