am e0232039: Merge "Restore the ability to use ctrl_interface directory"

* commit 'e0232039e0a59f7ef4fc67dad178387b2d5fffba':
  Restore the ability to use ctrl_interface directory
This commit is contained in:
Jean-Baptiste Queru 2012-09-20 16:17:28 -07:00 committed by Android Git Automerger
commit c0ab77364b

View file

@ -367,7 +367,19 @@ int update_ctrl_interface(const char *config_file) {
} else {
strcpy(ifc, CONTROL_IFACE_PATH);
}
if ((sptr = strstr(pbuf, "ctrl_interface="))) {
/*
* if there is a "ctrl_interface=<value>" entry, re-write it ONLY if it is
* NOT a directory. The non-directory value option is an Android add-on
* that allows the control interface to be exchanged through an environment
* variable (initialized by the "init" program when it starts a service
* with a "socket" option).
*
* The <value> is deemed to be a directory if the "DIR=" form is used or
* the value begins with "/".
*/
if ((sptr = strstr(pbuf, "ctrl_interface=")) &&
(!strstr(pbuf, "ctrl_interface=DIR=")) &&
(!strstr(pbuf, "ctrl_interface=/"))) {
char *iptr = sptr + strlen("ctrl_interface=");
int ilen = 0;
int mlen = strlen(ifc);