speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] Connect to socket if SPEECHD_ADDRESS begins with /


From: Trevor Saunders
Subject: [PATCH 3/3] Connect to socket if SPEECHD_ADDRESS begins with /
Date: Tue, 24 Jul 2012 16:50:26 -0400

On Tue, Jul 24, 2012 at 10:13:05PM +0200, Boris Du?ek wrote:
> From: Boris Dus?ek <dusek at brailcom.org>
> 
> On OS X, launchd can pass the location of a socket with random name it
> creates only in an environment variable, with its value being the
> absolute path to the socket. This environment variable is then set in
> the whole user session and any clients should check its value to know
> how to connect to the relevant service.
> 
> To adapt Speech Dispatcher client libraries to this, either we would
> invent a new environment variable only for this
> purpose (e.g. SPEECHD_LAUNCHD_ADDRESS) and honor it on OS X before
> trying the traditional means of specifying the communication socket,
> or we can use SPEECHD_ADDRESS by adding a new rule - any value
> beginning with "/" is treated as path. This does not collide with the
> current use of SPEECHD_ADDRESS - it begins with specifier of the
> communication method and no specifier begins with "/". Also no IP or
> DNS address begins with "/".
> 
> I chose the second variant since it does not require adding a new
> environment variable to the mix, and might simplify the syntax for
> some current users setting the socket path. But I admit it might be a
> bit non-systematic.

yeah, adding a new variable sounds like a mess, this seems reasonable
fwiw.

> +     } else if (env_address[0] == '/') {
> +             address->method = SPD_METHOD_UNIX_SOCKET;
> +             address->unix_socket_name = strdup(env_address);

sadly this isn't a world where malloc has been made infalable (and
that's probably the way it should stay since this is libspeechd code), and you
don't immediately dereference the pointer strdup hands you, so you
should probably handle failure somehow.

Trev



reply via email to

[Prev in Thread] Current Thread [Next in Thread]