dcavalca / rpms / systemd

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