chiark / gitweb /
unit: when reading description from LSB prefer short over long description
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Jul 2010 00:16:14 +0000 (02:16 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 7 Jul 2010 00:21:42 +0000 (02:21 +0200)
src/service.c

index d6897341645c057d0ff2cb01670a0d777e9b7d5e..c9abb08670d585ccdf8b97c66e1669ef8c3be6fe 100644 (file)
@@ -457,7 +457,8 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                         s->sysv_runlevels = d;
                                 }
 
-                        } else if (startswith_no_case(t, "description:")) {
+                        } else if (startswith_no_case(t, "description:") &&
+                                   !u->meta.description) {
 
                                 size_t k = strlen(t);
                                 char *d;
@@ -603,9 +604,13 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                         s->sysv_runlevels = d;
                                 }
 
-                        } else if (startswith_no_case(t, "Description:")) {
+                        } else if (startswith_no_case(t, "Description:") &&
+                                   !u->meta.description) {
                                 char *d;
 
+                                /* We use the long description only if
+                                 * no short description is set. */
+
                                 state = LSB_DESCRIPTION;
 
                                 if (!(d = strdup(strstrip(t+12)))) {
@@ -616,13 +621,9 @@ static int service_load_sysv_path(Service *s, const char *path) {
                                 free(u->meta.description);
                                 u->meta.description = d;
 
-                        } else if (startswith_no_case(t, "Short-Description:") &&
-                                   !u->meta.description) {
+                        } else if (startswith_no_case(t, "Short-Description:")) {
                                 char *d;
 
-                                /* We use the short description only
-                                 * if no long description is set. */
-
                                 state = LSB;
 
                                 if (!(d = strdup(strstrip(t+18)))) {