[systemd-commits] src/socket.c

Lennart Poettering lennart at kemper.freedesktop.org
Mon Feb 14 15:44:28 PST 2011


 src/socket.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 7b4bf06ba7f31ea8069fc8927729d70ab98b9b64
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Feb 15 00:40:17 2011 +0100

    socket: refuse socket activation for SysV services
    
    Make sure that when a .socket unit is installed without its matching
    .service we don't end up activating a legacy SysV/LSB service with the
    same name. SysV/LSB style services do not support passing sockets and we
    don't want to extend SysV/LSB to ensure we don't break compatibility
    with other systems.

diff --git a/src/socket.c b/src/socket.c
index e386c7f..3f57e35 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -169,6 +169,13 @@ static int socket_instantiate_service(Socket *s) {
         if (r < 0)
                 return r;
 
+#ifdef HAVE_SYSV_COMPAT
+        if (SERVICE(u)->sysv_path) {
+                log_error("Using SysV services for socket activation is not supported. Refusing.");
+                return -ENOENT;
+        }
+#endif
+
         u->meta.no_gc = true;
         s->service = SERVICE(u);
         return 0;
@@ -1354,12 +1361,19 @@ static int socket_start(Unit *u) {
                 if (s->service->meta.load_state != UNIT_LOADED)
                         return -ENOENT;
 
-                /* If the service is alredy actvie we cannot start the
+                /* If the service is alredy active we cannot start the
                  * socket */
                 if (s->service->state != SERVICE_DEAD &&
                     s->service->state != SERVICE_FAILED &&
                     s->service->state != SERVICE_AUTO_RESTART)
                         return -EBUSY;
+
+#ifdef HAVE_SYSV_COMPAT
+                if (s->service->sysv_path) {
+                        log_error("Using SysV services for socket activation is not supported. Refusing.");
+                        return -ENOENT;
+                }
+#endif
         }
 
         assert(s->state == SOCKET_DEAD || s->state == SOCKET_FAILED);



More information about the systemd-commits mailing list