[systemd-commits] 2 commits - src/systemctl

Thomas H.P. Andersen phomes at kemper.freedesktop.org
Wed Dec 4 13:34:10 PST 2013


 src/systemctl/systemctl.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 071066a5e509d0138fd2941f46eb60e0a07106bb
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Wed Dec 4 20:51:03 2013 +0100

    systemctl: make an always true assert static
    
    Silences a warning i clang

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d5d6b9f..561572c 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -82,6 +82,7 @@ static enum dependency {
         DEPENDENCY_REVERSE,
         DEPENDENCY_AFTER,
         DEPENDENCY_BEFORE,
+        _DEPENDENCY_MAX
 } arg_dependency = DEPENDENCY_FORWARD;
 static const char *arg_job_mode = "replace";
 static UnitFileScope arg_scope = UNIT_FILE_SYSTEM;
@@ -1183,7 +1184,7 @@ static int list_dependencies_print(const char *name, int level, unsigned int bra
 
 static int list_dependencies_get_dependencies(sd_bus *bus, const char *name, char ***deps) {
 
-        static const char *dependencies[] = {
+        static const char *dependencies[_DEPENDENCY_MAX] = {
                 [DEPENDENCY_FORWARD] = "Requires\0"
                                        "RequiresOverridable\0"
                                        "Requisite\0"
@@ -1206,7 +1207,7 @@ static int list_dependencies_get_dependencies(sd_bus *bus, const char *name, cha
         assert(bus);
         assert(name);
         assert(deps);
-        assert(arg_dependency < ELEMENTSOF(dependencies));
+        assert_cc(ELEMENTSOF(dependencies) == _DEPENDENCY_MAX);
 
         path = unit_dbus_path_from_name(name);
         if (!path)

commit 4fd944ec822414b743bc39de37a4751c729463d3
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Wed Dec 4 20:01:07 2013 +0100

    systemctl: no need to fdopen stdout

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index f3db6bf..d5d6b9f 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3690,7 +3690,6 @@ static int cat(sd_bus *bus, char **args) {
                 _cleanup_free_ char *fragment_path = NULL;
                 _cleanup_strv_free_ char **dropin_paths = NULL;
                 sd_bus_error error;
-                FILE *stdout;
                 char **path;
 
                 n = unit_name_mangle(*name);
@@ -3731,8 +3730,6 @@ static int cat(sd_bus *bus, char **args) {
                         continue;
                 }
 
-                stdout = fdopen(STDOUT_FILENO, "a");
-
                 if (!isempty(fragment_path)) {
                         fprintf(stdout, "# %s\n", fragment_path);
                         fflush(stdout);



More information about the systemd-commits mailing list