[systemd-commits] 9 commits - Makefile.am TODO src/activate src/login src/shared src/socket-proxy src/systemd

Lennart Poettering lennart at kemper.freedesktop.org
Thu Nov 7 16:53:40 CET 2013


 Makefile.am                      |    2 +-
 TODO                             |    2 ++
 src/activate/activate.c          |    8 ++++++--
 src/login/pam-module.c           |   10 ++++------
 src/shared/macro.h               |    2 --
 src/shared/util.c                |    2 ++
 src/shared/util.h                |    1 +
 src/socket-proxy/socket-proxyd.c |   34 ++++++++++++++++++----------------
 src/systemd/_sd-common.h         |   28 +++++++++++++++++++++++++---
 src/systemd/sd-bus-protocol.h    |   10 ++++------
 src/systemd/sd-bus-vtable.h      |   10 ++++------
 src/systemd/sd-bus.h             |    8 ++------
 src/systemd/sd-event.h           |   10 ++++------
 src/systemd/sd-id128.h           |   10 ++++------
 src/systemd/sd-journal.h         |   20 ++++++++------------
 src/systemd/sd-login.h           |   10 ++++------
 src/systemd/sd-memfd.h           |   10 ++++------
 src/systemd/sd-messages.h        |    9 +++------
 src/systemd/sd-rtnl.h            |   10 ++++------
 src/systemd/sd-shutdown.h        |   12 +++++++++++-
 src/systemd/sd-utf8.h            |   10 ++++------
 21 files changed, 115 insertions(+), 103 deletions(-)

New commits:
commit e633ea1c9c5249ed5bf708a2ed6385c4823d4706
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 16:53:14 2013 +0100

    socket-proxy: actually properly keep track of connections

diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
index b6a7f1c..56e660d 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -53,6 +53,8 @@ typedef struct Context {
 } Context;
 
 typedef struct Connection {
+        Context *context;
+
         int server_fd, client_fd;
         int server_to_client_buffer[2]; /* a pipe */
         int client_to_server_buffer[2]; /* a pipe */
@@ -68,6 +70,9 @@ static const char *arg_remote_host = NULL;
 static void connection_free(Connection *c) {
         assert(c);
 
+        if (c->context)
+                set_remove(c->context->connections, c);
+
         sd_event_source_unref(c->server_event_source);
         sd_event_source_unref(c->client_event_source);
 
@@ -91,7 +96,7 @@ static void context_free(Context *context) {
         while ((es = set_steal_first(context->listen)))
                 sd_event_source_unref(es);
 
-        while ((c = set_steal_first(context->connections)))
+        while ((c = set_first(context->connections)))
                 connection_free(c);
 
         set_free(context->listen);
@@ -403,11 +408,18 @@ static int add_connection_socket(Context *context, sd_event *event, int fd) {
         if (!c)
                 return log_oom();
 
+        c->context = context;
         c->server_fd = fd;
         c->client_fd = -1;
         c->server_to_client_buffer[0] = c->server_to_client_buffer[1] = -1;
         c->client_to_server_buffer[0] = c->client_to_server_buffer[1] = -1;
 
+        r = set_put(context->connections, c);
+        if (r < 0) {
+                free(c);
+                return log_oom();
+        }
+
         r = get_remote_sockaddr(&sa, &salen);
         if (r < 0)
                 goto fail;
@@ -491,8 +503,6 @@ static int add_listen_socket(Context *context, sd_event *event, int fd) {
         assert(event);
         assert(fd >= 0);
 
-        log_info("Listening on %i", fd);
-
         r = set_ensure_allocated(&context->listen, trivial_hash_func, trivial_compare_func);
         if (r < 0) {
                 log_oom();

commit 2c408cb6276e3b8d18fb4e2a81a1128d8bbaa70d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 16:52:47 2013 +0100

    activate: print a nice message if no fd to listen on was specified

diff --git a/src/activate/activate.c b/src/activate/activate.c
index f0944aa..3198f7d 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -127,7 +127,7 @@ static int open_sockets(int *epoll_fd, bool accept) {
                 _cleanup_free_ char *name = NULL;
 
                 getsockname_pretty(fd, &name);
-                log_info("Listening on %s.", strna(name));
+                log_info("Listening on %s as %i.", strna(name), fd);
 
                 r = add_epoll(*epoll_fd, fd);
                 if (r < 0)
@@ -381,6 +381,10 @@ int main(int argc, char **argv, char **envp) {
         n = open_sockets(&epoll_fd, arg_accept);
         if (n < 0)
                 return EXIT_FAILURE;
+        if (n == 0) {
+                log_error("No sockets to listen on specified or passed in.");
+                return EXIT_FAILURE;
+        }
 
         for (;;) {
                 struct epoll_event event;
@@ -394,7 +398,7 @@ int main(int argc, char **argv, char **envp) {
                         return EXIT_FAILURE;
                 }
 
-                log_info("Communication attempt on fd:%d", event.data.fd);
+                log_info("Communication attempt on fd %i.", event.data.fd);
                 if (arg_accept) {
                         r = do_accept(argv[optind], argv + optind, envp,
                                       event.data.fd);

commit 2cd33d82b6b4dd3eec3ccf6b8da36f3f3312ff32
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 16:44:59 2013 +0100

    shutdown: as sd-shutdown.h is a drop-in header it should not include any other headers of ours

diff --git a/src/systemd/sd-shutdown.h b/src/systemd/sd-shutdown.h
index 6698c8c..1d65549 100644
--- a/src/systemd/sd-shutdown.h
+++ b/src/systemd/sd-shutdown.h
@@ -26,7 +26,13 @@
 
 #include <inttypes.h>
 
-#include "_sd-common.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _sd_packed_
+#  define _sd_packed_ __attribute__((packed))
+#endif
 
 typedef enum sd_shutdown_mode {
         SD_SHUTDOWN_NONE = 0,
@@ -107,4 +113,8 @@ struct sd_shutdown_command {
  * anybody.
  */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif

commit 0095c45415ad24338342369d76d5635088294eae
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 16:44:48 2013 +0100

    api: replace manual C++ guards by macros

diff --git a/src/systemd/_sd-common.h b/src/systemd/_sd-common.h
index b861e33..b0c48aa 100644
--- a/src/systemd/_sd-common.h
+++ b/src/systemd/_sd-common.h
@@ -40,9 +40,31 @@
 #  define _sd_packed_ __attribute__((packed))
 #endif
 
-#ifndef _sd_stringify
-#  define _sd_xstringify(x) #x
-#  define _sd_stringify(x) _sd_xstringify(x)
+#ifndef _SD_STRINGIFY
+#  define _SD_XSTRINGIFY(x) #x
+#  define _SD_STRINGIFY(x) _SD_XSTRINGIFY(x)
+#endif
+
+#ifndef _SD_BEGIN_DECLARATIONS
+#  ifdef __cplusplus
+#    define _SD_BEGIN_DECLARATIONS                              \
+        extern "C" {                                            \
+        struct __useless_struct_to_allow_trailing_semicolon__
+#  else
+#    define _SD_BEGIN_DECLARATIONS                              \
+        struct __useless_struct_to_allow_trailing_semicolon__
+#  endif
+#endif
+
+#ifndef _SD_END_DECLARATIONS
+#  ifdef __cplusplus
+#    define _SD_END_DECLARATIONS                                \
+        }                                                       \
+        struct __useless_struct_to_allow_trailing_semicolon__
+#  else
+#    define _SD_END_DECLARATIONS                                \
+        struct __useless_struct_to_allow_trailing_semicolon__
+#  endif
 #endif
 
 #endif
diff --git a/src/systemd/sd-bus-protocol.h b/src/systemd/sd-bus-protocol.h
index ff2bcc9..07fade6 100644
--- a/src/systemd/sd-bus-protocol.h
+++ b/src/systemd/sd-bus-protocol.h
@@ -24,9 +24,9 @@
 
 #include <endian.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "_sd-common.h"
+
+_SD_BEGIN_DECLARATIONS;
 
 /* Types of message */
 
@@ -213,8 +213,6 @@ enum {
 #define SD_BUS_ERROR_INVALID_SIGNATURE          "org.freedesktop.DBus.Error.InvalidSignature"
 #define SD_BUS_ERROR_INCONSISTENT_MESSAGE       "org.freedesktop.DBus.Error.InconsistentMessage"
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-bus-vtable.h b/src/systemd/sd-bus-vtable.h
index d1642ba..18fc30b 100644
--- a/src/systemd/sd-bus-vtable.h
+++ b/src/systemd/sd-bus-vtable.h
@@ -22,9 +22,9 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "_sd-common.h"
+
+_SD_BEGIN_DECLARATIONS;
 
 typedef struct sd_bus_vtable sd_bus_vtable;
 
@@ -128,8 +128,6 @@ struct sd_bus_vtable {
                 .type = _SD_BUS_VTABLE_END,                             \
         }
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index 48edc59..e626407 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -30,9 +30,7 @@
 #include "sd-memfd.h"
 #include "_sd-common.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+_SD_BEGIN_DECLARATIONS;
 
 /* Types */
 
@@ -269,8 +267,6 @@ int sd_bus_error_has_name(const sd_bus_error *e, const char *name);
                 &(x).bytes[8],  &(x).bytes[9],  &(x).bytes[10], &(x).bytes[11], \
                 &(x).bytes[12], &(x).bytes[13], &(x).bytes[14], &(x).bytes[15]
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h
index bc4c01d..8262e13 100644
--- a/src/systemd/sd-event.h
+++ b/src/systemd/sd-event.h
@@ -28,6 +28,8 @@
 #include <inttypes.h>
 #include <signal.h>
 
+#include "_sd-common.h"
+
 /*
   Why is this better than pure epoll?
 
@@ -37,9 +39,7 @@
   - Handles signals and child PIDs
 */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+_SD_BEGIN_DECLARATIONS;
 
 typedef struct sd_event sd_event;
 typedef struct sd_event_source sd_event_source;
@@ -115,8 +115,6 @@ int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec);
 int sd_event_source_get_signal(sd_event_source *s);
 int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid);
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-id128.h b/src/systemd/sd-id128.h
index 6066f39..5bae965 100644
--- a/src/systemd/sd-id128.h
+++ b/src/systemd/sd-id128.h
@@ -25,9 +25,9 @@
 #include <inttypes.h>
 #include <string.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "_sd-common.h"
+
+_SD_BEGIN_DECLARATIONS;
 
 /* 128 Bit ID APIs. See sd-id128(3) for more information. */
 
@@ -102,8 +102,6 @@ static inline int sd_id128_equal(sd_id128_t a, sd_id128_t b) {
 
 #define SD_ID128_NULL ((sd_id128_t) { .qwords = { 0, 0 }})
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-journal.h b/src/systemd/sd-journal.h
index e319c6e..751e7f9 100644
--- a/src/systemd/sd-journal.h
+++ b/src/systemd/sd-journal.h
@@ -31,12 +31,10 @@
 #include "sd-id128.h"
 #include "_sd-common.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* Journal APIs. See sd-journal(3) for more information. */
 
+_SD_BEGIN_DECLARATIONS;
+
 /* Write to daemon */
 int sd_journal_print(int priority, const char *format, ...) _sd_printf_(2, 3);
 int sd_journal_printv(int priority, const char *format, va_list ap) _sd_printf_(2, 0);
@@ -54,11 +52,11 @@ int sd_journal_perror_with_location(const char *file, const char *line, const ch
 /* implicitly add code location to messages sent, if this is enabled */
 #ifndef SD_JOURNAL_SUPPRESS_LOCATION
 
-#define sd_journal_print(priority, ...) sd_journal_print_with_location(priority, "CODE_FILE=" __FILE__, "CODE_LINE=" _sd_stringify(__LINE__), __func__, __VA_ARGS__)
-#define sd_journal_printv(priority, format, ap) sd_journal_printv_with_location(priority, "CODE_FILE=" __FILE__, "CODE_LINE=" _sd_stringify(__LINE__), __func__, format, ap)
-#define sd_journal_send(...) sd_journal_send_with_location("CODE_FILE=" __FILE__, "CODE_LINE=" _sd_stringify(__LINE__), __func__, __VA_ARGS__)
-#define sd_journal_sendv(iovec, n) sd_journal_sendv_with_location("CODE_FILE=" __FILE__, "CODE_LINE=" _sd_stringify(__LINE__), __func__, iovec, n)
-#define sd_journal_perror(message) sd_journal_perror_with_location("CODE_FILE=" __FILE__, "CODE_LINE=" _sd_stringify(__LINE__), __func__, message)
+#define sd_journal_print(priority, ...) sd_journal_print_with_location(priority, "CODE_FILE=" __FILE__, "CODE_LINE=" _SD_STRINGIFY(__LINE__), __func__, __VA_ARGS__)
+#define sd_journal_printv(priority, format, ap) sd_journal_printv_with_location(priority, "CODE_FILE=" __FILE__, "CODE_LINE=" _SD_STRINGIFY(__LINE__), __func__, format, ap)
+#define sd_journal_send(...) sd_journal_send_with_location("CODE_FILE=" __FILE__, "CODE_LINE=" _SD_STRINGIFY(__LINE__), __func__, __VA_ARGS__)
+#define sd_journal_sendv(iovec, n) sd_journal_sendv_with_location("CODE_FILE=" __FILE__, "CODE_LINE=" _SD_STRINGIFY(__LINE__), __func__, iovec, n)
+#define sd_journal_perror(message) sd_journal_perror_with_location("CODE_FILE=" __FILE__, "CODE_LINE=" _SD_STRINGIFY(__LINE__), __func__, message)
 
 #endif
 
@@ -153,8 +151,6 @@ int sd_journal_get_catalog_for_message_id(sd_id128_t id, char **ret);
 #define SD_JOURNAL_FOREACH_UNIQUE(j, data, l)                           \
         for (sd_journal_restart_unique(j); sd_journal_enumerate_unique((j), &(data), &(l)) > 0; )
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-login.h b/src/systemd/sd-login.h
index 961bd88..a230aff 100644
--- a/src/systemd/sd-login.h
+++ b/src/systemd/sd-login.h
@@ -25,9 +25,7 @@
 #include <sys/types.h>
 #include <inttypes.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "_sd-common.h"
 
 /*
  * A few points:
@@ -49,6 +47,8 @@ extern "C" {
  * See sd-login(3) for more information.
  */
 
+_SD_BEGIN_DECLARATIONS;
+
 /* Get session from PID. Note that 'shared' processes of a user are
  * not attached to a session, but only attached to a user. This will
  * return an error for system processes and 'shared' processes of a
@@ -182,8 +182,6 @@ int sd_login_monitor_get_events(sd_login_monitor *m);
 /* Get timeout for poll(), as usec value relative to CLOCK_MONOTONIC's epoch */
 int sd_login_monitor_get_timeout(sd_login_monitor *m, uint64_t *timeout_usec);
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-memfd.h b/src/systemd/sd-memfd.h
index ee140e4..f4ef8f1 100644
--- a/src/systemd/sd-memfd.h
+++ b/src/systemd/sd-memfd.h
@@ -26,9 +26,9 @@
 #include <sys/types.h>
 #include <stdio.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "_sd-common.h"
+
+_SD_BEGIN_DECLARATIONS;
 
 typedef struct sd_memfd sd_memfd;
 
@@ -51,8 +51,6 @@ int sd_memfd_get_sealed(sd_memfd *m);
 int sd_memfd_get_size(sd_memfd *m, uint64_t *sz);
 int sd_memfd_set_size(sd_memfd *m, uint64_t sz);
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-messages.h b/src/systemd/sd-messages.h
index 775aa23..947bd1a 100644
--- a/src/systemd/sd-messages.h
+++ b/src/systemd/sd-messages.h
@@ -23,10 +23,9 @@
 ***/
 
 #include "sd-id128.h"
+#include "_sd-common.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+_SD_BEGIN_DECLARATIONS;
 
 /* Hey! If you add a new message here, you *must* also update the
  * message catalog with an appropriate explanation */
@@ -84,8 +83,6 @@ extern "C" {
 
 #define SD_MESSAGE_BOOTCHART        SD_ID128_MAKE(9f,26,aa,56,2c,f4,40,c2,b1,6c,77,3d,04,79,b5,18)
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
index e3ad37c..223f403 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -24,9 +24,9 @@
 
 #include <inttypes.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "_sd-common.h"
+
+_SD_BEGIN_DECLARATIONS;
 
 typedef struct sd_rtnl sd_rtnl;
 typedef struct sd_rtnl_message sd_rtnl_message;
@@ -57,8 +57,6 @@ int sd_rtnl_message_get_type(sd_rtnl_message *m, uint16_t *type);
 int sd_rtnl_message_append(sd_rtnl_message *m, unsigned short type, const void *data);
 int sd_rtnl_message_read(sd_rtnl_message *m, unsigned short *type, void **data);
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif
diff --git a/src/systemd/sd-utf8.h b/src/systemd/sd-utf8.h
index 54ef5fb..4a43eb7 100644
--- a/src/systemd/sd-utf8.h
+++ b/src/systemd/sd-utf8.h
@@ -22,15 +22,13 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "_sd-common.h"
+
+_SD_BEGIN_DECLARATIONS;
 
 const char *sd_utf8_is_valid(const char *s);
 const char *sd_ascii_is_valid(const char *s);
 
-#ifdef __cplusplus
-}
-#endif
+_SD_END_DECLARATIONS;
 
 #endif

commit 1ec6af16f501a6e281fe5604d4be8380bad38646
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 16:43:25 2013 +0100

    socket-proxyd: no need to redefine sockaddr union

diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
index 12d58d4..b6a7f1c 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -63,14 +63,6 @@ typedef struct Connection {
         sd_event_source *server_event_source, *client_event_source;
 } Connection;
 
-union sockaddr_any {
-        struct sockaddr sa;
-        struct sockaddr_un un;
-        struct sockaddr_in in;
-        struct sockaddr_in6 in6;
-        struct sockaddr_storage storage;
-};
-
 static const char *arg_remote_host = NULL;
 
 static void connection_free(Connection *c) {
@@ -106,7 +98,7 @@ static void context_free(Context *context) {
         set_free(context->connections);
 }
 
-static int get_remote_sockaddr(union sockaddr_any *sa, socklen_t *salen) {
+static int get_remote_sockaddr(union sockaddr_union *sa, socklen_t *salen) {
         int r;
 
         assert(sa);
@@ -117,7 +109,7 @@ static int get_remote_sockaddr(union sockaddr_any *sa, socklen_t *salen) {
                 strncpy(sa->un.sun_path, arg_remote_host, sizeof(sa->un.sun_path)-1);
                 sa->un.sun_path[sizeof(sa->un.sun_path)-1] = 0;
 
-                *salen = offsetof(union sockaddr_any, un.sun_path) + strlen(sa->un.sun_path);
+                *salen = offsetof(union sockaddr_union, un.sun_path) + strlen(sa->un.sun_path);
 
         } else if (arg_remote_host[0] == '@') {
                 sa->un.sun_family = AF_UNIX;
@@ -125,7 +117,7 @@ static int get_remote_sockaddr(union sockaddr_any *sa, socklen_t *salen) {
                 strncpy(sa->un.sun_path+1, arg_remote_host+1, sizeof(sa->un.sun_path)-2);
                 sa->un.sun_path[sizeof(sa->un.sun_path)-1] = 0;
 
-                *salen = offsetof(union sockaddr_any, un.sun_path) + 1 + strlen(sa->un.sun_path + 1);
+                *salen = offsetof(union sockaddr_union, un.sun_path) + 1 + strlen(sa->un.sun_path + 1);
 
         } else {
                 _cleanup_freeaddrinfo_ struct addrinfo *result = NULL;
@@ -154,7 +146,7 @@ static int get_remote_sockaddr(union sockaddr_any *sa, socklen_t *salen) {
                 }
 
                 assert(result);
-                if (result->ai_addrlen > sizeof(union sockaddr_any)) {
+                if (result->ai_addrlen > sizeof(union sockaddr_union)) {
                         log_error("Address too long.");
                         return -E2BIG;
                 }
@@ -388,7 +380,7 @@ fail:
 }
 
 static int add_connection_socket(Context *context, sd_event *event, int fd) {
-        union sockaddr_any sa = {};
+        union sockaddr_union sa = {};
         socklen_t salen;
         Connection *c;
         int r;

commit 3deadb918f1ac034e4edf03e1ba88468ee76bd62
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 16:42:54 2013 +0100

    util: add circle to special chars we can draw

diff --git a/src/shared/macro.h b/src/shared/macro.h
index d3f4245..9e94495 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -278,11 +278,9 @@ do {                                                                    \
  */
 #define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b)
 
-
 /* Returns the number of chars needed to format variables of the
  * specified type as a decimal string. Adds in extra space for a
  * negative '-' prefix. */
-
 #define DECIMAL_STR_MAX(type)                                           \
         (1+(sizeof(type) <= 1 ? 3 :                                     \
             sizeof(type) <= 2 ? 5 :                                     \
diff --git a/src/shared/util.c b/src/shared/util.c
index d753781..7d41a7a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5466,6 +5466,7 @@ const char *draw_special_char(DrawSpecialChar ch) {
                         [DRAW_TREE_RIGHT]         = "\342\224\224\342\224\200", /* └─ */
                         [DRAW_TREE_SPACE]         = "  ",                       /*    */
                         [DRAW_TRIANGULAR_BULLET]  = "\342\200\243 ",            /* ‣  */
+                        [DRAW_BLACK_CIRCLE]       = "\342\227\217 ",            /* ●  */
                 },
                 /* ASCII fallback */ {
                         [DRAW_TREE_VERT]          = "| ",
@@ -5473,6 +5474,7 @@ const char *draw_special_char(DrawSpecialChar ch) {
                         [DRAW_TREE_RIGHT]         = "`-",
                         [DRAW_TREE_SPACE]         = "  ",
                         [DRAW_TRIANGULAR_BULLET]  = "> ",
+                        [DRAW_BLACK_CIRCLE]       = "* ",
                 }
         };
 
diff --git a/src/shared/util.h b/src/shared/util.h
index 8b4c155..d46ff27 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -622,6 +622,7 @@ typedef enum DrawSpecialChar {
         DRAW_TREE_RIGHT,
         DRAW_TREE_SPACE,
         DRAW_TRIANGULAR_BULLET,
+        DRAW_BLACK_CIRCLE,
         _DRAW_SPECIAL_CHAR_MAX
 } DrawSpecialChar;
 const char *draw_special_char(DrawSpecialChar ch);

commit 29d230f6f297e76ea06eb1365f6f6c16a92abf9e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 16:42:36 2013 +0100

    pam: the DECIMAL_STR_MAX macro is awesome, let's use it

diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index 58f9742..f469244 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -403,9 +403,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
         }
 
         if (vtnr > 0) {
-                char buf[11];
+                char buf[DECIMAL_STR_MAX(vtnr)];
                 snprintf(buf, sizeof(buf), "%u", vtnr);
-                char_array_0(buf);
 
                 r = pam_misc_setenv(handle, "XDG_VTNR", buf, 0);
                 if (r != PAM_SUCCESS) {
@@ -443,14 +442,13 @@ _public_ PAM_EXTERN int pam_sm_close_session(
                 int flags,
                 int argc, const char **argv) {
 
+        _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+        _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
+        _cleanup_bus_unref_ sd_bus *bus = NULL;
         const void *p = NULL, *existing = NULL;
         const char *id;
         int r;
 
-        _cleanup_bus_unref_ sd_bus *bus = NULL;
-        _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
-
         assert(handle);
 
         /* Only release session if it wasn't pre-existing when we

commit 49a6199b42b34ac16b03af9eec9b4ee7a31aa9f4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 16:36:14 2013 +0100

    update TODO

diff --git a/TODO b/TODO
index 9cdeabb..29dc721 100644
--- a/TODO
+++ b/TODO
@@ -46,6 +46,8 @@ CGroup Rework Completion:
 
 Features:
 
+* tmpfiles: to make sure we don't delete unpacked tarballs with old timestamps right-away never delete stuff that is inside a directory with a new mtime
+
 * "systemctl mask" should find all names by which a unit is accessible
   (i.e. by scanning for symlinks to it) and link them all to /dev/null
 

commit aac6ad0d2f3dd295129256b0b8d66bea876b94b6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Nov 7 16:35:36 2013 +0100

    build-sys: don't install sd-shutdown.h, it is a drop-in header like sd-readahead.h

diff --git a/Makefile.am b/Makefile.am
index ccecc3e..5c3cbc1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1506,7 +1506,7 @@ systemd_shutdownd_LDADD = \
 	libsystemd-daemon-internal.la \
 	libsystemd-shared.la
 
-pkginclude_HEADERS += \
+dist_doc_DATA += \
 	src/systemd/sd-shutdown.h
 
 # ------------------------------------------------------------------------------



More information about the systemd-commits mailing list