diff options
author | Irfan Sheriff <isheriff@google.com> | 2012-05-23 11:51:34 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2012-05-23 11:52:51 -0700 |
commit | 48d5a1d50750ffa5d14b64841fc7e81dadafd1a4 (patch) | |
tree | 3d6ff613f9352a8dcc79c6c95a20ada11feb47d5 /dhcpcd.c | |
parent | e4f0d1bd87c052c1b4af410599558de1e8875379 (diff) | |
download | external_dhcpcd-48d5a1d50750ffa5d14b64841fc7e81dadafd1a4.zip external_dhcpcd-48d5a1d50750ffa5d14b64841fc7e81dadafd1a4.tar.gz external_dhcpcd-48d5a1d50750ffa5d14b64841fc7e81dadafd1a4.tar.bz2 |
Reuse system properties for p2p
p2p interfaces keep increasing. Reuse a single "p2p" phrase to track all
p2p specific properties.
Longer term, we will remove the use of system properties for dhcp
Bug: 6522164
Change-Id: Ic9c54dc1904d2e1e8c33bbbc17234ed801f845dc
Diffstat (limited to 'dhcpcd.c')
-rw-r--r-- | dhcpcd.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -1751,6 +1751,8 @@ main(int argc, char **argv) struct timespec ts; #ifdef ANDROID + /* Reuse system properties for a p2p interface */ + char p2p_interface[PROPERTY_KEY_MAX]; switchUser(); #endif closefrom(3); @@ -1915,9 +1917,15 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } + if (strncmp(argv[optind], "p2p", 3) == 0) { + strncpy(p2p_interface, "p2p", sizeof(p2p_interface)); + } else { + strncpy(p2p_interface, argv[optind], sizeof(p2p_interface)); + } + if (snprintf(pidpropname, sizeof(pidpropname), - "dhcp.%s.pid", argv[optind]) >= PROPERTY_KEY_MAX) + "dhcp.%s.pid", p2p_interface) >= PROPERTY_KEY_MAX) exit(EXIT_FAILURE); property_get(pidpropname, pidpropval, NULL); if (strlen(pidpropval) == 0) @@ -2000,9 +2008,15 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } + if (strncmp(argv[optind], "p2p", 3) == 0) { + strncpy(p2p_interface, "p2p", sizeof(p2p_interface)); + } else { + strncpy(p2p_interface, argv[optind], sizeof(p2p_interface)); + } + if (snprintf(pidpropname, sizeof(pidpropname), - "dhcp.%s.pid", argv[optind]) >= PROPERTY_KEY_MAX) + "dhcp.%s.pid", p2p_interface) >= PROPERTY_KEY_MAX) exit(EXIT_FAILURE); if (snprintf(pidpropval, sizeof(pidpropval), "%d", getpid()) >= PROPERTY_VALUE_MAX) exit(EXIT_FAILURE); |