summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-05-03 14:31:50 +0000
committerRoy Marples <roy@marples.name>2016-05-03 14:31:50 +0000
commit8b71cd46f337b493dc3eea0d80e1f47298a07f61 (patch)
tree62b8dcdb2b86d5f45495fad39a6001aa520b9bf4 /dhcpcd.c
parent9d3a9d1320b7ab2ce180112d238006488071e201 (diff)
downloaddhcpcd-8b71cd46f337b493dc3eea0d80e1f47298a07f61.tar.xz
Rework control_open to be cleaner for static analysis.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 09a5dd03..0e207430 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1455,12 +1455,6 @@ main(int argc, char **argv)
const char *siga = NULL;
#endif
- int seq;
- seq = INT_MAX;
- printf ("%d\n", seq);
- seq++;
- printf ("%u\n", (uint32_t)seq);
-
/* Test for --help and --version */
if (argc > 1) {
if (strcmp(argv[1], "--help") == 0) {
@@ -1732,13 +1726,11 @@ printpidfile:
!(ctx.options & DHCPCD_TEST))
{
#endif
- if (ctx.options & DHCPCD_MASTER)
- i = -1;
- else
- i = control_open(&ctx, argv[optind]);
- if (i == -1)
- i = control_open(&ctx, NULL);
- if (i != -1) {
+ if (!(ctx.options & DHCPCD_MASTER))
+ ctx.control_fd = control_open(argv[optind]);
+ if (ctx.control_fd == -1)
+ ctx.control_fd = control_open(NULL);
+ if (ctx.control_fd != -1) {
logger(&ctx, LOG_INFO,
"sending commands to master dhcpcd process");
len = control_send(&ctx, argc, argv);